

Pip will allow you to declare a specific Requests version as a dependency in a requirements.txt file, along with other dependencies in a virtual environment. You can pip install Requests into your virtual environment with the following command: python -m pip install requests Pip Install Requests as a Dependency Venv will create a virtual Python installation in the folder. Run the following command to create a new project in a virtual environment/ virtual directory:įor Linux, run the following in your terminal: sh The easiest way to install Requests from source code is to use the ActiveState Platform, which will automatically build and package it for you. To uninstall Requests, enter: pip uninstall Requests Alternate Methods for installing Requests Install Requests from Source Code version 2.6.6, enter: pip install requests=2.6.0 To install a specific version of requests, eg. To upgrade requests to the latest version, enter: pip install -upgrade requests If not installed, you can install Requests on Linux, MacOS, and the Windows operating systems by running: pip install requests Output should be similar to: Name: requests Version: 2.26.0 Summary: Python HTTP for Humans. Requests InstallationĬheck if Requests is already installed and up-to-date by entering the following command: python -m pip show requests

Now you can use Requests with the JSON method instead.

Prior to the availability of the Requests library, it was necessary to manually add query strings to URLs, and form-encode PUT & POST data. For example, this is how you make an HTTP POST request:
