Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.

No. requests is not part of Python’s standard library. It is a third-party package distributed through PyPI, so install it in the environment that runs your program, usually with python -m pip install requests. Python does include the standard-library module urllib.request, which can make HTTP requests without adding a dependency.

What “built in” means in Python

A built-in or standard-library module is shipped with Python itself. You can import it after installing Python, without downloading a separate package. For example, urllib.request is documented as part of Python’s standard library: Python’s urllib.request documentation.

Requests is different. The package is published separately on PyPI at pypi.org/project/requests/. A machine may already have Requests installed because another application or virtual environment added it, but that does not make it part of Python. A clean interpreter can raise ModuleNotFoundError: No module named 'requests' until you install the package.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Import names and distribution names also differ in capitalization: install the distribution named requests, then write import requests in Python.

How to install Requests in the correct environment

Install with the interpreter you will run

Use the interpreter-qualified pip command so the package goes into the same Python installation that executes your script:

python -m pip install requests

On systems where python points to Python 2 or is unavailable, use:

python3 -m pip install requests

On Windows, the Python launcher is another reliable option:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
py -m pip install requests

The Requests quickstart explains that the package must be installed before use: Requests Quickstart.

Use a virtual environment for an application

  1. Create an environment in your project directory: python -m venv .venv.
  2. Activate it. On macOS or Linux, run source .venv/bin/activate. On Windows PowerShell, run .venvScriptsActivate.ps1.
  3. Install Requests while the environment is active: python -m pip install requests.
  4. Record the dependency for deployment: python -m pip freeze > requirements.txt.
  5. On another machine, recreate the environment and run python -m pip install -r requirements.txt.

Installing globally can work for a quick script, but a virtual environment prevents one project’s package versions from interfering with another project.

Verify both installation and interpreter selection

python -c "import sys, requests; print(sys.executable); print(requests.__version__)"

This prints the executable path and the Requests version imported by that exact interpreter. If installation appeared to succeed but the import still fails, compare the path shown here with the interpreter selected by your IDE, notebook kernel, service manager or container.

What version and Python support should you expect?

At the time of the cited PyPI listing, the Requests project page showed version 2.34.2, uploaded May 14, 2026, and stated official support for Python 3.10 and newer. These are live package details that can change, so check the current PyPI project page before pinning a version or upgrading a production service.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Do not infer that an older Python interpreter will receive the same support. Match the package’s current metadata to the Python version used by your deployment. If your organization requires repeatable builds, pin a tested version in your dependency file rather than relying on an unbounded latest install.

Requests versus Python’s built-in urllib.request

Both can open URLs and send HTTP requests. The decision is mainly about dependency policy and the interface your code needs, not whether HTTP is possible.

Question requests urllib.request
Included with Python? No; install the PyPI package. Yes; part of the standard library.
Typical import import requests import urllib.request
Dependency policy Add and manage an external dependency. No additional package is required.
Interface level Requests describes itself as a higher-level HTTP client interface. Lower-level standard-library URL-opening API.
Documented conveniences Sessions, authentication, connection pooling, timeouts, streaming and automatic decompression are covered in the project documentation. Provides standard-library primitives; you assemble the behavior you need.
Best fit Applications that value a concise client API and can declare a dependency. Minimal installations, dependency-restricted tools or code that only needs standard-library components.

Python’s documentation recommends Requests as a higher-level HTTP client interface, while documenting urllib.request as the standard-library option. That recommendation is about convenience and abstraction; it does not mean Requests is bundled with Python or that it is always the better choice.

Runnable Requests examples

A basic GET request with a timeout

import requests

response = requests.get("https://httpbin.org/get", timeout=20)
response.raise_for_status()
print(response.json())

Always set a timeout for network code. Without one, a stalled connection can leave a worker waiting indefinitely. raise_for_status() turns HTTP 4xx and 5xx responses into an exception instead of allowing an error page to be processed as if it were successful.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Sending parameters and headers

import requests

params = {"q": "python", "page": 1}
headers = {"Accept": "application/json"}

response = requests.get(
    "https://httpbin.org/anything",
    params=params,
    headers=headers,
    timeout=20,
)
response.raise_for_status()
print(response.url)
print(response.json())

Passing query values through params lets Requests encode them correctly. Keep credentials out of source code; load API keys from environment variables or a secret manager.

Reuse connections with a session

import requests

with requests.Session() as session:
    session.headers.update({"Accept": "application/json"})
    for endpoint in ("/get", "/anything"):
        response = session.get("https://httpbin.org" + endpoint, timeout=20)
        response.raise_for_status()
        print(response.status_code)

A session keeps shared settings together and allows connection reuse across requests. For a one-off call, the top-level requests.get() function is sufficient.

Handle network failures separately from HTTP errors

import requests

try:
    response = requests.get("https://example.com", timeout=(5, 30))
    response.raise_for_status()
except requests.exceptions.Timeout:
    print("The server did not respond within the timeout.")
except requests.exceptions.ConnectionError as exc:
    print(f"Could not connect: {exc}")
except requests.exceptions.HTTPError as exc:
    print(f"The server returned an HTTP error: {exc}")
else:
    print(response.text[:200])

The tuple timeout sets separate connection and read limits. A timeout, DNS failure or refused connection is not the same event as a server returning an HTTP status such as 404 or 500, so handling them separately produces clearer recovery behavior.

Using Requests to call a screenshot API

Requests is often used to call JSON APIs or download binary files. For example, the following downloads a website screenshot from ScreenshotNeo and writes the response bytes to disk:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
import requests

r = requests.get(
    "https://api.screenshotneo.com/v1/shot",
    params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
    timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)

Use an API key in an environment variable in real applications, check the response headers and choose the output format and other capture options documented at ScreenshotNeo’s documentation.

Or skip the browser setup

If your goal is a website screenshot rather than browser automation, ScreenshotNeo provides a direct HTTP endpoint. Before capture it accepts the cookie or consent banner like a visitor and removes more than 60 known consent platforms, newsletter popups and chat widgets. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed; the response identifies the result with X-Page-Verdict and X-Billed headers. It also offers an MCP server with take_screenshot, get_page_info and capture_pdf tools for Claude, Cursor and other MCP clients.

One-call examples:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests; r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90); open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' }); const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

There is a free allowance of 1,000 screenshots per month with no card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting common installation and import errors

ModuleNotFoundError: No module named 'requests'

  • Install with the same interpreter that runs the script: python -m pip install requests.
  • Print sys.executable and compare it with the interpreter used by your editor or service.
  • If a virtual environment is intended, activate it before installing and running.

pip is not recognized or permission errors

Use python -m pip (or py -m pip on Windows) instead of calling pip directly. In a managed machine, install inside a virtual environment rather than changing the system Python. A system administrator may need to provide the package through the organization’s approved dependency process.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Requests is installed, but the wrong version appears

Run python -m pip show requests and the verification command above. Multiple Python installations commonly explain a mismatch. Reinstall or upgrade through the interpreter whose path your application actually uses, then update the project’s dependency lock or requirements file.

Import works locally but fails in deployment

Declare Requests in requirements.txt or your project’s dependency metadata and install dependencies during the build. Do not assume that a package present on a developer laptop is present in a container, virtual machine, serverless runtime or clean CI worker.

Which should you choose?

  • Choose urllib.request when avoiding third-party dependencies is a firm requirement and its lower-level API meets your needs.
  • Choose Requests when you want its higher-level interface and conveniences such as sessions, authentication support, pooling, timeouts, streaming and decompression, and your project can install an external package.
  • Choose based on the Python versions and HTTP behavior your deployment supports; neither library is universally correct.

The direct answer remains unchanged: Requests is installable software, not a built-in Python library. Python includes urllib.request; Requests must be installed and declared wherever your application runs.

Frequently Asked Questions

Does installing Requests modify Python’s standard library?

No. It installs a separate package into the selected environment, normally site-packages or a virtual environment.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can I use Requests without internet access during installation?

Only if the package wheel or an approved internal package mirror is already available. Otherwise pip must obtain Requests from a package source before your program can import it.

Should a library I publish force users to install Requests?

Declare Requests as a dependency only if your library requires it, and document the supported Python versions. If avoiding external dependencies is essential, consider whether urllib.request can satisfy the implementation.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.