python
SNMP polling using python
To play with SNMP using python install easysnmp python module. SNMP v2 Let us take a sample device Poll device using snmpwalk to get sysDescr value Python code to get same Save above code as pysnmpv2.py and execute SNMP v3 Lets take a sample device and its SNMP v3 parameters First using command line you […]
Agentless predictive asset scan on networks
This is an agent less solution to scan complete network and build an asset report. All you need is a Linux host with python3 and pythonping, nmap and ipaddress python modules along with nmap Linux package. Since we are not authenticating to hosts and just doing a predictive scan using underline nmap tool, so report […]
PySpark on python3 and Debian
Install openjdk 8 To install openjdk 8 on debian 10, follow steps mentioned at https://linuxize.com/post/install-java-on-debian-10/pyspark does not works well with newer versions of Java, so stick with openjdk or oracle java 8. Install PySpark Next install pyspark using python pip, I prefer python3 so installation goes with pip3 PySpark brings along required hadoop components Basic […]
Text to speech conversion in python
Think of an real life scenario where you need text to speech conversion……ok, what about reading a story for you ? Let us see how simple is this to implement in python. You need gTTS, google text to speech, python module for this. Here is how you install this module Since we are saving converted […]
Speech to text in python
These days a number of apps use speech to text feature to interact with users. Typical example is using voice search on a grocery app, where you want to find items by voice search rather typing item names. Let us implement a basic speech to text solution using python and SpeechRecognition module. First you have […]
Web scraping with Python
Web scraping is very powerful methodology to extract and track “things of interest” from websites. Let us see how it works with an example. Here I am performing search for items on an online retailer and fetch price of searched items. To do this I wrote a module having one class having two abstract functions. […]
Monitor websites using python
If you have many websites, internal or external, and you want to monitor them all together to check their availability, then this solution can help you. This quick piece of python code reads website urls and other optional parameters from a text file “urls.txt”. Each row has url, connection timeout(sec), read timeout(sec), http basic authentication […]
Write your first REST API using Python Flask
Since years programming concepts have been evolving with new ideas and improvements. Idea of API, Application Programming Interface, came out to build integration between applications/software/platforms. It has simplified integration between totally different applications and platforms. In early days (even now), APIs were in form of client APIs. Software developers/organizations offer client software component which is […]
Write your first python module
If you are planning to build a mid to enterprise size project/product then you should consider object oriented coding practice. This benefits in many ways. For eg, your code remains tidy and you can reuse components of your code in other projects. Module is essentially a collection of several classes and class functions. These functions […]
Python filter function
This is an interesting feature in python. Suppose you have a list of items and you want to apply quick filters such as “greater than x”, “less than x”, “above average”, “below average” on list items, then filter() method makes it quite handy. Typical syntax of filter function is like filter(some_func_name, list_of_items) You can also […]