Stories from the Web Crawling trenches in Requests

Python Requests Cheatsheet

Author: Mohan Ganesan

Date: Jan 9, 2024

Overview of Requests, a popular HTTP library for Python. Features include making GET and POST requests, handling response content and headers.

How to Handle Timeout error in Python requests

Author: Mohan Ganesan

Date: Oct 22, 2023

Timeouts are critical for making requests in Python. They prevent hanging requests and wastage of resources. The requests library provides flexible ways to set timeouts globally or per-request.

Downloading Files with Python Requests - Tips, Tricks and Code Example

Author: Mohan Ganesan

Date: Oct 31, 2023

Learn how to use Python Requests to download files from the web with ease. Requests provides a simple API for making HTTP calls, supports advanced features like streaming downloads and authentication, and is actively maintained. Use Requests to download files like a pro!

Accessing HTTPS Sites with Self-Signed Certs in Python Requests

Author: Mohan Ganesan

Date: Feb 3, 2024

Methods to securely access HTTPS sites using self-signed certificates with Python Requests: certifi bundle, custom PEM certs, REQUESTS_CA_BUNDLE, SSLContext.

Sending Multipart Form Data with Python's urllib

Author: Mohan Ganesan

Date: Feb 8, 2024

Python's urllib library provides tools to handle multipart form data for integrating with web services. Use requests library to simplify sending multipart form data.

Fixing “ModuleNotFoundError: No module named ‘requests’” Error in Python

Author: Mohan Ganesan

Date: Oct 22, 2023

The 'ModuleNotFoundError: No module named 'requests'' error occurs when the requests module is not installed or the environment is misconfigured. Follow the steps to install requests, update PYTHONPATH, and use the correct Python version.

Caching in Python

Author: Mohan Ganesan

Date: Dec 6, 2023

Learn how to cache API responses in Python to improve performance. Caching reduces API requests, improves speed, and lowers costs.

Expert Techniques for Disabling SSL Certificate Verification in Python Requests

Author: Mohan Ganesan

Date: Oct 31, 2023

Requests is the king of Python libraries for HTTP requests. Learn how to disable SSL certificate verification selectively and securely.

Python's URL Handling Libraries compared - urllib vs requests

Author: Mohan Ganesan

Date: Nov 17, 2023

Python's URL handling libraries have evolved over time, from urllib to urllib2 to urllib3 and finally to requests. Each library offers different features and capabilities, making it important to choose the right one for your needs.

Web Scraping with Python & ChatGPT

Author: Mohan Ganesan

Date: Sep 25, 2023

Web scraping is the process of extracting data from websites. Python and ChatGPT can assist in web scraping tasks. Popular libraries include Beautiful Soup, Scrapy, Selenium, and Requests.

A Beginner's Guide to Uploading Files with Python Requests

Author: Mohan Ganesan

Date: Oct 31, 2023

Requests is a Python library for making HTTP requests, including file uploads. It simplifies the process and provides features like automatic JSON encoding and decoding. This guide walks through the steps for uploading single and multiple files, as well as additional options and error handling.

Speeding up Python Requests using gzip and other techniques

Author: Mohan Ganesan

Date: Dec 6, 2023

Making HTTP Requests Through a Proxy in Elixir with HTTPoison in 2024

Author: Mohan Ganesan

Date: Jan 9, 2024

Learn how to install HTTPoison in Elixir, make requests, configure global and per-request proxies, use SOCKS proxies, handle authentication and TLS, and manage IP blocks and captchas with proxy rotation services.

Persisting Sessions with Httpx in Python

Author: Mohan Ganesan

Date: Feb 5, 2024

Guide on utilizing Httpx's session support to maintain state and persist cookies across multiple requests in Python.

Troubleshooting "ModuleNotFoundError: No module named 'requests'"

Author: Mohan Ganesan

Date: Feb 3, 2024

Frustrated with ModuleNotFoundError when importing requests in Python? Check installation, Python version, virtual environments, module name conflicts, and Python path.

Simplifying HTTP Requests in Python: Urllib vs. Requests

Author: Mohan Ganesan

Date: Feb 8, 2024

When working with HTTP requests in Python, you have two options: urllib or requests. urllib is low-level but built-in, while requests is simple and intuitive. Use requests for typical tasks and urllib for fine-grained control.

Sending HTTP Requests in Python: Request vs Requests

Author: Mohan Ganesan

Date: Feb 3, 2024

Python applications often require HTTP requests. The request library is built-in, while requests is a more powerful third-party library that simplifies the process.

Simplifying HTTP Requests in Python: Requests vs urllib3

Author: Mohan Ganesan

Date: Feb 3, 2024

Making HTTP requests in Python: choose between requests and urllib3. Requests is simple and beginner friendly, while urllib3 offers more control and customization.

Making Async HTTP Requests in Python with requests and asyncio

Author: Mohan Ganesan

Date: Feb 3, 2024

Python requests library provides API for HTTP requests. asyncio and aiohttp enable non-blocking requests. grequests uses asyncio for concurrent requests. asyncio is efficient for I/O heavy work.

Setting Cookies Early with aiohttp Requests

Author: Mohan Ganesan

Date: Feb 22, 2024

Set cookies early in aiohttp requests to ensure proper inclusion and prevent unexpected errors or login pages.

Parsing JSON Responses from APIs in Python Requests

Author: Mohan Ganesan

Date: Feb 3, 2024

When working with APIs in Python, use response.json() to parse JSON data. Handle invalid JSON gracefully and check status codes and Content-Type before parsing.

HttpWebRequest Proxies in C# in 2024

Author: Mohan Ganesan

Date: Jan 9, 2024

The article explains how to direct HttpWebRequest traffic through a proxy using the WebProxy class. It covers creating a WebProxy, assigning it to HttpWebRequest, proxy authentication, default system proxy settings, and making requests via proxy.

Troubleshooting "ImportError: No module named requests" in Python

Author: Mohan Ganesan

Date: Feb 3, 2024

When working with Python, you may encounter the error ImportError: No module named requests. Here are some troubleshooting tips to resolve this issue.

Streaming Uploads in Python Requests using File-Like Objects

Author: Mohan Ganesan

Date: Feb 3, 2024

Efficiently upload large binary data in Python Requests using file-like objects and streaming uploads.

Simplifying HTTP Requests in Python: urllib2 vs urllib vs requests

Author: Mohan Ganesan

Date: Feb 3, 2024

Making HTTP requests in Python: from urllib2 to requests. urllib2 - Python's Default HTTP Client. urllib - A Minor Improvement. requests - A Simple Yet Powerful Library.

Speed Up Your Python Web Requests: Requests vs. Urllib

Author: Mohan Ganesan

Date: Feb 3, 2024

Python's requests library provides a fast and simple interface for making HTTP requests, offering better performance than urllib for most use cases.

Rate Limiting Requests with aiohttp

Author: Mohan Ganesan

Date: Feb 22, 2024

Prevent abuse and reduce server load by rate limiting requests using aiohttp's ThrottleConcurrency middleware.

Troubleshooting Stale Data in Python Requests

Author: Mohan Ganesan

Date: Feb 3, 2024

Check for client-side caching in requests and disable. Ensure server is not caching responses. Use sessions for APIs that require statefulness.

异步爬虫:使用 aiohttp 提高 Python 爬虫性能

Author: Mohan Ganesan

Date: Mar 3, 2024

Python的requests库提供了一个简单方便的HTTP客户端,非常适合编写爬虫。但是requests使用同步IO,这意味着它在等待响应时会阻塞线程。对于IO密集型的爬虫应用来说,这会大大降低性能。aiohttp库使用了异步IO,可以在等待响应的同时继续执行其他任务,从而大大提高了爬虫的效率。本文将介绍如何使用aiohttp来编写高性能的异步爬虫。

Is Urllib built in Python?

Author: Mohan Ganesan

Date: Feb 20, 2024

Python's urllib module provides the building blocks for fetching data and interacting with APIs over HTTP.

urllib Connection Pool in Python

Author: Mohan Ganesan

Date: Feb 8, 2024

Using a connection pool in Python's urllib module is a best practice for making multiple requests, boosting efficiency and speed.

Making Python Requests Appear Mobile

Author: Mohan Ganesan

Date: Feb 3, 2024

Make Python requests appear as mobile by setting User-Agent header, using mobile HTTP client library, or proxying through a mobile device.

How to use URL in Python?

Author: Mohan Ganesan

Date: Feb 20, 2024

Python has great URL handling capabilities out of the box. Whether you need to parse URLs, download files, call web APIs, or interact with websites, Python has you covered!

Speed Up HTTP Requests: When to Use http.client over requests

Author: Mohan Ganesan

Date: Feb 3, 2024

Python offers options for HTTP requests with http.client and requests. http.client is faster for simple requests, while requests is more feature-rich. Use http.client for speed and requests for complex applications.

Requests vs urllib vs httpx vs aiohttp

Author: Mohan Ganesan

Date: Feb 3, 2024

Making HTTP requests in Python: comparing Requests, urllib, httpx, and aiohttp. Requests is the easiest, urllib is lower-level, httpx adds advanced features, and aiohttp is for asyncio-based code.

Is Urllib part of Python?

Author: Mohan Ganesan

Date: Feb 20, 2024

Python's urllib module is a basic tool for fetching data from URLs, but many prefer the more advanced Requests module for HTTP requests.

Easy Guide: Installing the Requests Library for Python on Windows

Author: Mohan Ganesan

Date: Feb 3, 2024

Learn how to install and use the Python requests library for making HTTP requests in your projects.

Using BeautifulSoup and Requests for Powerful Web Scraping

Author: Mohan Ganesan

Date: Oct 6, 2023

Requests and BeautifulSoup are two Python libraries that complement each other beautifully for web scraping purposes. They provide a powerful toolkit for extracting data from websites.

Is Urllib a standard Python package?

Author: Mohan Ganesan

Date: Feb 8, 2024

Urllib is a standard Python package for working with HTTP resources. It provides tools for fetching URLs, handling redirects, parsing response data, encoding requests, and more.

Is Urllib in Python standard library?

Author: Mohan Ganesan

Date: Feb 20, 2024

Python's built-in urllib module makes retrieving data from the internet easy. It's a great starting point for basic HTTP requests before using more full-featured libraries like Requests.

Tired of getting blocked while scraping the web?

ProxiesAPI handles headless browsers and rotates proxies for you.
Get access to 1,000 free API credits, no credit card required!