1.Requests
Requests is a wonderful python library to send HTTP/1.1 requests within a program. It provides a simpler and higher level way of creating requests for internet interactions. Requests is a definite recommended addition to your collection of python libraries. Below is a quick script to scrape HTML using urllib3:
similarly, a script with the same functionality but using Requests is:
We have only made a simple HTTP request for the website front page but we are already one line shorter. The Requests library handles a lot of stuff like Keep-Alive, connection poolings, SSL, authentication, and other modern web concepts and functionality.
2. Scrapy
Scrapy is one of the python libraries that provides an easy way to create website scrapers for web crawling. It is easy to parse and pull data from websites and for that reason, we can easily make a simple spider to scrape the front page of a website.
3. Pillow(PIL)
Pillow (PIL) is one of the python libraries that provides an easy way to interact and manipulate images. It provides easy ways to resize, rotate and manipulate the image overall. PIL is one of the python libraries that is easy to use and below is a simple program to get the type and size of an image.
4. SQLAlchemy
SQLAlchemy is one of the python libraries for database programming and it provides a programmatic way to access and interact with a SQL database. It also provides an Object Relational Mapper and also automates redundant tasks. As a result, the object model and database schema can be decoupled from the beginning of development. Above all, it is a powerful tool for SQL database interactions and below is a simple program to create a database with two tables.
5. BeautifulSoup
BeautifulSoup is another one of the python libraries that provide web scraping and it provides a powerful but easy way to parse documents and traverse the document tree. It easily navigates and parses HTML and XML and as a result is powerful with websites and XML documents. It can save developers countless hours is simple to use. I have written a simple request and parser to find all hyperlinks in a website.
6. Twisted
Twisted is one the best python libraries for networking because it removes a lot of complexity in network programming. It is event-driven and makes it easy to add networking functionality to a python program. It also includes support for SSL, UDP, IMAP, SSHv2 and more. Above all, it is a simple but powerful way to add networking to python programs. Twisted is a strong addition to your libraries for application development and communication.
This is a simple server that observers for connections and prints out what it receives.
Similarly, this is the client that will connect and send a message to the server.
7. NumPy
The NumPy library is another one of the python libraries for data science that makes computation tasks in python easier. NumPy is useful for data science, data mining, linear algebra, N-dimension array calculations, and scientific applications. It provides easy ways to operate on N-dimension arrays such as matrix products.
8. Scapy
The Scapy library is one of the python libraries for networking but it allows a programmer to manipulate network packets similarly to Nmap or tcpdump. Scapy also provides a way to do functionality other tools won’t like injecting custom 802.11 frames, sending invalid frames and more. Overall it is great for getting access and information to network packets but requires a greater knowledge of networking to fully take advantage of its capabilities in networking. A simpler TCP connect scanner is shown. Scapy is a great addition to any cyber security and security oriented collection of python libraries.
9. Pandas
Pandas is one of the python libraries for data science that provides an easy way to manipulate and prepare data for analysis. This is great for Data Mining, Machine Learning, Data Analysis and so much more. Due to Pandas’s capabilities in data preparation, it has become one of great python libraries for Machine Learning and Data mining. It allows a Python-centered workflow when doing data analysis in python.
Reading in a CSV file is as easy as:
Similarly, it is just as simple to select and read the first 2 rows from the csv_data.
10. TensorFlow
TensorFlow is one of the python libraries for Machine Learning framework that makes it easier for developers to gain access to Machine Learning functions without the need to know the extensive mathematics behind the different machine learning models. The Tensorflow Library is a bit more extensive than a simple 20 line program to get some cool Machine Learning/Artificial Intelligence functionality working, but you can check out the article discussing it here Tensorflow and Keras QuickDive. Below I create two 1-D tensors and multiply them together.
11.Keras (Bonus)
The Keras library is a high-level neural network framework, one of the python libraries for machine learning, that works with TensorFlow for Deep Learning(Insert link here to another post). Keras with TensorFlow can be used for rapid creation and testing of Deep Learning Models. It is worth noting that both Keras and Tensorflow are python libraries for machine learning, but Keras runs on top of Tensorflow.