Category: Requests
-
Memory Leak in Python requests
When a programmer forgets to clear a memory allocated in heap memory, the memory leak occurs. It’s a type of resource leak or wastage. When there is a memory leak in the application, the memory of the machine gets filled and slows down the performance of the machine. This is a serious issue while building…
-
Exception Handling Of Python Requests Module
Python request module is a simple and elegant Python HTTP library. It provides methods for accessing Web resources via HTTP. In the following article, we will use the HTTP GET method in the Request module. This method requests data from the server and the Exception handling comes in handy when the response is not successful. Here,…
-
SSL Certificate Verification
Requests verifies SSL certificates for HTTPS requests, just like a web browser. SSL Certificates are small data files that digitally bind a cryptographic key to an organization’s details. Often, a website with a SSL certificate is termed as secure website. By default, SSL verification is enabled, and Requests will throw a SSLError if it’s unable…
-
Authentication using Python requests
Authentication refers to giving a user permissions to access a particular resource. Since, everyone can’t be allowed to access data from every URL, one would require authentication primarily. To achieve this authentication, typically one provides authentication data through Authorization header or a custom header defined by server. Example – # import requests module importrequests fromrequests.auth importHTTPBasicAuth…
-
Convert JSON data Into a Custom Python Object
Let us see how to convert JSON data into a custom object in Python. Converting JSON data into a custom python object is also known as decoding or deserializing JSON data. To decode JSON data we can make use of the json.loads(), json.load() method and the object_hook parameter. The object_hook parameter is used so that, when we execute json.loads(), the return value of object_hook…
-
response.headers
Python requests are generally used to fetch the content from a particular resource URI. Whenever we make a request to a specified URI through Python, it returns a response object. Now, this response object would be used to access certain features such as content, headers, etc. This article revolves around how to check the response.headers…
-
GET method – Python requests
Requests library is one of the important aspects of Python for making HTTP requests to a specified URL. This article revolves around how one can make GET request to a specified URL using requests.GET() method. Before checking out GET method, let’s figure out what a GET request is – GET Http Method The GET method is used…
-
How to install requests in Python – For windows, linux, mac
Requests is an elegant and simple HTTP library for Python, built for human beings. One of the most famous libraries for python used by developers al over the world. This article revolves around how one can install requests library of python in Windows/ Linux/ macOS, etc. Installation Windows For installing requests in windows, one would…
-
What is Web Scraping and How to Use It?
Suppose you want some information from a website? Let’s say a paragraph on Donald Trump! What do you do? Well, you can copy and paste the information from Wikipedia to your own file. But what if you want to get large amounts of information from a website as quickly as possible? Such as large amounts…
-
Python Requests Tutorial
The Requests library in Python is one of the integral parts of Python for making HTTP requests to a specified URL. Whether it be REST APIs or Web Scraping, requests are a must to be learned for proceeding further with these technologies. When one makes a request to a URI, it returns a response. Python requests provide…