Recent Python Posts from Tech Monger:///feeds/python/2021-04-30T17:03:17.691104ZWerkzeugGenerate Executable Binary From Python Program - Pyinstallerhttps://techmonger.github.io/82/pyinstaller-script-to-binary2021-04-30T17:03:17.691104Z2021-04-30T14:40:21.328054ZTech Monger<p class="lead">
As a python developer you might want to ship your code to other platforms where python interpreter is not installed. In such event you would need to rely on the binary execution. You can use <code>pyinstaller</code> to achieve your aim; where you can convert your python code to executable binary.
Check ODBC Connectivity from Pythonhttps://techmonger.github.io/78/odbc-test-pyodbc2020-11-03T17:08:45.194955Z2020-11-02T16:52:05.869541ZTech Monger<p class="lead">If you are connecting to the <abbr title="Open Database Connectivity">ODBC</abbr> database then it is necessary to test connection before creating ODBC data source inisde <code>ODBC.INI</code> file. Below we will create simple python script which initiate ODBC connection with details provided inside ODBC.ini file and output if connection is working or failing.</p>
How Password Hashing Works in Ubuntu Linuxhttps://techmonger.github.io/74/linux-password-hashing2019-07-06T14:12:28.378608Z2019-07-06T12:42:06.108035ZTech Monger<p class="lead">
If you ever wondered where and how user passwords are stored in linux file system then this post will answer most of your questions. Below we will discuss password hashing in ubuntu but many other linux distributions follow this pattern. Below read assumes that you have basic familiarity with hash function like md5 or sha-256.
How to use Jinja2 in Python without Flaskhttps://techmonger.github.io/69/jinja2-render-html2019-01-05T05:50:09.136214Z2019-01-04T18:43:27.606962ZTech Monger<p class="lead">
Due to various reasons you might want to render dynamic html content outside of your web application. For example to create the html email body. Also you might want to use jinja2 with web framework which does not have inbuilt support for it. Below we will explain how to use jinja2 as standalone utility in python script with the help of an <a href="#example">example code</a>.
Change TOR IP Address with Python using STEMhttps://techmonger.github.io/68/tor-new-ip-python2018-12-25T17:02:26.558297Z2018-12-25T14:37:43.102142ZTech Monger<p>
If you are using TOR inside python script then you may find need to renew IP Address. In this tutorial we will change IP address using <code>stem</code> package. We will use TOR controller file <code>torrc</code> to communicate with TOR.
Solving Scrapy User timeout caused connection failurehttps://techmonger.github.io/65/troubleshoot-scrapy-user-timeout2018-11-20T07:06:50.542649Z2018-11-19T18:00:39.563913ZTech Monger<p class="lead">If the website you are scraping is not responding to your requests then your spider would report failure due to request timeout and throw following error.</p>
Custom Validation Messages with WTFormshttps://techmonger.github.io/64/wtf-custom-validation-hack2018-11-11T09:18:28.423182Z2018-11-11T07:56:08.911691ZTech Monger<p class="lead">
While using WTF or Flask-WTF for the form validation you would often find yourself adding custom validation messages according to the requirement of your web application. You can always use WTF's <code>ValidationError</code> API however in this tutorial we will show you clever hack to add validation messages during page rendering. We will show <a href="#example">example code</a> with <a href="/tag/flask" title="Flask Tutorials">flask</a> but you can use this method with any other framework which is using WTF for form validation.
Scrapy Get Redirect URLs and Request URLhttps://techmonger.github.io/63/scrapy-redirect-urls2018-11-10T07:16:38.730746Z2018-11-09T13:46:24.517791ZTech Monger<p class="lead">
If you ever wanted to figure out all the redirect urls that scrapy spider hopped on or what is the currently requested URL by the spider then you easily get that using following <a href="#example">example code</a>.
Scrapy Random Fake User Agent Examplehttps://techmonger.github.io/62/example-scrapy-fake-user-agent2018-10-19T19:16:03.373783Z2018-10-19T18:30:06.053868ZTech Monger<p class="lead">
If sites you are crawling with scrapy dont respond to your request then you should use randomly generated user agent in your request. Scrapy Fake User Agent is one of the open source and useful extension which will help you evade bot detection programs easily.
Faster TNSPING in Python with Queue and Threadshttps://techmonger.github.io/56/faster-tnsping-python2018-09-20T10:23:44.699240Z2018-09-20T10:11:50.627193ZTech Monger<p class="lead">
Previously we have seen how can we implement TNSPING command in python and process tnsping response to make programmatic decisions. But that approach may not be optimal when you have large set of net service names to check. In this tutorial we will implement concurrent version of TNSPING checker in python with help of Threads and Queues.
Producer Consumer Model in Pythonhttps://techmonger.github.io/55/producer-consumer-python2018-09-20T10:26:35.181279Z2018-09-18T19:23:36.256250ZTech Monger<p class="lead">
In this tutorial we will learn how to write python code that provides solution to the classic producer consumer problem with the help of an <a href="#example">example</a>. We will make use of inbuilt python features such as <a href="#thread">Thread</a> and <a href="#queue">Queue</a>.