{
 "kind": "tool",
 "slug": "requests-py",
 "path": "tools/requests-py/",
 "name": "Requests",
 "maker": null,
 "density": "full",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "HTTP clients and networking",
   "tools/http-clients/"
  ]
 ],
 "lead": "Talk to web services from Python.",
 "chips": [
  {
   "label": "HTTP clients and networking",
   "path": "tools/http-clients/"
  },
  {
   "label": "PYPI"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "pip install requests"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/psf/requests"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "Apache-2.0",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": "each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.",
   "note": "Free for commercial and closed-source use under Apache-2.0.",
   "src": "https://github.com/psf/requests/blob/main/LICENSE"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 2, 2026",
   "note": "Latest GitHub release May 14, 2026. ",
   "src": "https://github.com/psf/requests"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "425 projects",
   "status": "info",
   "sub": "#2 of 126 in its category",
   "note": "Dependency in 425 public GitHub projects set up for AI coding agents that we scanned (6.8%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Install only",
   "status": "info",
   "sub": null,
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": null
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily; card checked Nov 10, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What Requests does",
   "parts": [
    {
     "t": "prose",
     "text": "Requests is a free Python library that lets your program fetch web pages and talk to online services in a few lines. Your app can ask a weather or payment service for data, send forms and files, and stay logged in across several requests. It waits for each answer before going on, so very busy apps that must do many things at once use other libraries."
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Ask an online service for data",
       "text": "A script or app asks a weather, maps or shop service for data and reads the answer as plain Python values.",
       "idea": false
      },
      {
       "title": "Send data with your key",
       "text": "Your app saves a note, a lead or an order in another service and sends your secret key in a header with it.",
       "idea": false
      },
      {
       "title": "Upload files to a service",
       "text": "Send a report, a photo or a CSV export to a service the way a web form would, with the file name and type.",
       "idea": false
      },
      {
       "title": "Retry when a service hiccups",
       "text": "When a busy service answers \"try again later\", your script waits a little and tries again instead of failing at once.",
       "idea": false
      },
      {
       "title": "Download big files in pieces",
       "text": "Save a large export or video to disk piece by piece, so the whole file never has to fit in memory.",
       "idea": false
      },
      {
       "title": "Stay logged in across requests",
       "text": "Log in to a site or service once and keep its cookies and headers for every next request in the same script.",
       "idea": false
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "Requests popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "88",
       "of": "/ 100",
       "l": "Gid Score, #17 overall"
      },
      {
       "n": "35M",
       "l": "downloads a week, pypi"
      },
      {
       "n": "54.7K",
       "l": "GitHub stars"
      },
      {
       "n": "425",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How Requests is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "Requests is a dependency in 425 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (26.2% of the 1,623 Python ones), #2 of 126 in http clients and networking.",
      "Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 3,788; those are left out of every share on this page.",
      "The most used alternative in our scan is httpx (280 projects).",
      "Projects that use it most often also use python-dotenv (56.9%), Pydantic (44.0%), Uvicorn (40.5%).",
      "It is more common in projects set up for OpenClaw (12.9%) than for OpenCode (3.2%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "207 projects, 6.8%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "206 projects, 6.3%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "153 projects, 6.3%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "43 projects, 12.9%",
       "v": "OpenClaw",
       "path": "agents/openclaw/"
      },
      {
       "l": "24 projects, 5.1%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "20 projects, 7.2%",
       "v": "Devin Desktop",
       "path": "agents/devin-desktop/"
      },
      {
       "l": "17 projects, 3.6%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      },
      {
       "l": "11 projects, 3.2%",
       "v": "OpenCode",
       "path": "agents/opencode/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 56.9% of its projects",
       "v": "python-dotenv",
       "path": "tools/python-dotenv/"
      },
      {
       "l": "In 44.0% of its projects",
       "v": "Pydantic",
       "path": "tools/pydantic/"
      },
      {
       "l": "In 40.5% of its projects",
       "v": "Uvicorn",
       "path": "tools/uvicorn/"
      },
      {
       "l": "In 38.1% of its projects",
       "v": "NumPy",
       "path": "tools/numpy/"
      },
      {
       "l": "In 36.2% of its projects",
       "v": "FastAPI",
       "path": "tools/fastapi/"
      },
      {
       "l": "In 36.0% of its projects",
       "v": "PyYAML",
       "path": "tools/pyyaml/"
      },
      {
       "l": "In 29.4% of its projects",
       "v": "pandas",
       "path": "tools/pandas/"
      },
      {
       "l": "In 26.1% of its projects",
       "v": "OpenAI Python Library",
       "path": "tools/openai-pypi/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "Requests in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "No hand-built query strings or form bodies",
       "v": "The README says there is no need to manually add query strings to URLs or to form-encode <code>PUT</code> and <code>POST</code> data. For JSON it adds: \"nowadays, just use the <code>json</code> method!\""
      },
      {
       "l": "Keep-alive and pooling come from urllib3",
       "v": "The docs say keep-alive and HTTP connection pooling are \"100% automatic\" and credit urllib3 for this."
      },
      {
       "l": "Docs cover Transport Adapters and blocking behavior",
       "v": "The Advanced Usage section has chapters titled \"Transport Adapters\" and \"Blocking Or Non-Blocking?\". If your project needs concurrent requests, read the second one before you commit. The Community Guide also lists a Requests-Threads package."
      },
      {
       "l": "Auth docs go past Basic",
       "v": "The docs have separate pages for Basic, Digest, OAuth 1, and OAuth 2 and OpenID Connect authentication. A further page covers writing new forms of authentication."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Official support is Python 3.10+",
       "v": "The docs say Requests officially supports Python 3.10+. They add that it \"runs great on PyPy\"."
      },
      {
       "l": "<code>Request.headers.update()</code> callers may need typing changes",
       "v": "Release 2.34.2 moved the <code>headers</code> input type back to <code>Mapping</code>. The release notes say users calling <code>Request.headers.update()</code> may need to narrow typing in their code."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Basic auth and reading the response"
    },
    {
     "t": "tabs",
     "label": "Example",
     "items": [
      {
       "tab": "Python",
       "code": ">>> import requests\n>>> r = requests.get('https://httpbin.org/basic-auth/user/pass', auth=('user', 'pass'))\n>>> r.status_code\n200\n>>> r.headers['content-type']\n'application/json; charset=utf8'\n>>> r.encoding\n'utf-8'\n>>> r.text\n'{\"authenticated\": true, ...'\n>>> r.json()\n{'authenticated': True, ...}"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about Requests",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Funding",
       "path": "tools/funding/",
       "items": [
        "Own page: https://www.python.org/psf/sponsorship/"
       ]
      },
      {
       "title": "Head to head",
       "items": [
        {
         "text": "Requests vs httpx",
         "note": "used together in 56 projects",
         "path": "tools/compare/requests-vs-httpx/"
        },
        {
         "text": "Requests vs urllib3",
         "note": "used together in 88 projects",
         "path": "tools/compare/requests-vs-urllib3/"
        }
       ]
      },
      {
       "title": "Packages around it",
       "items": [
        "python-dotenv: Loads .env config",
        "solders: Solana Python types",
        "pydantic: Data validation",
        "numpy: Numeric arrays",
        "solana: Solana Python client",
        "uvicorn: ASGI server"
       ]
      },
      {
       "title": "More in HTTP clients and networking",
       "path": "tools/http-clients/",
       "items": [
        {
         "text": "Axios",
         "path": "tools/axios/"
        },
        {
         "text": "ws",
         "path": "tools/ws/"
        },
        {
         "text": "postgres",
         "path": "tools/postgres/"
        },
        {
         "text": "websockets",
         "path": "tools/websockets/"
        },
        {
         "text": "redis (Python)",
         "path": "tools/redis-pypi/"
        },
        {
         "text": "undici",
         "path": "tools/undici/"
        },
        {
         "text": "node-fetch",
         "path": "tools/node-fetch/"
        },
        {
         "text": "ioredis",
         "path": "tools/ioredis/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "Requests",
       "me": true,
       "facts": [
        "Apache-2.0",
        "Gid 88",
        "35M/wk"
       ]
      },
      {
       "name": "httpx",
       "why": "Pick httpx when your Python app needs async calls or many requests at once with an API close to requests.",
       "path": "tools/httpx/",
       "facts": [
        "BSD",
        "Gid 78",
        "198M/wk"
       ]
      },
      {
       "name": "aiohttp",
       "why": "Pick aiohttp when you build an asyncio app that also serves web pages or WebSockets itself.",
       "path": "tools/aiohttp/",
       "facts": [
        "Apache-2.0 AND MIT",
        "Gid 81",
        "134M/wk"
       ]
      },
      {
       "name": "urllib3",
       "why": "Pick urllib3 when you want the lower-level connection pooling library that requests itself is built on.",
       "path": "tools/urllib3/",
       "facts": [
        "MIT",
        "Gid 75",
        "376M/wk"
       ]
      },
      {
       "name": "websocket-client",
       "why": "WebSocket client library for Python with low-level API options.",
       "path": "tools/websocket-client/",
       "facts": [
        "Apache-2.0",
        "Gid 69",
        "41.6M/wk"
       ]
      },
      {
       "name": "h2",
       "why": "Pure Python HTTP/2 protocol implementation for building HTTP/2 clients.",
       "path": "tools/h2/",
       "facts": [
        "MIT",
        "Gid 64",
        "48.2M/wk"
       ]
      }
     ],
     "more": "Compare Requests with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Use the Python library requests (pin requests==2.34.2, Python 3.10+) to call the service; pass timeout= on every call, call raise_for_status() before reading r.json(), and read the token from an environment variable."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Install requests into your project's Python environment (Python 3.10 or newer).",
       "code": "python -m pip install requests",
       "src": "https://github.com/psf/requests/blob/main/README.md"
      },
      {
       "text": "Make a request and read the status, headers and body of the answer.",
       "code": ">>> import requests\n>>> r = requests.get('https://httpbin.org/basic-auth/user/pass', auth=('user', 'pass'))\n>>> r.status_code\n200\n>>> r.json()\n{'authenticated': True, ...}\n",
       "src": "https://github.com/psf/requests/blob/main/README.md"
      },
      {
       "text": "Always pass a timeout; without it a request can wait forever.",
       "code": null,
       "src": "https://requests.readthedocs.io/en/latest/user/quickstart/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## Requests\n- Install with `python -m pip install requests`. The project officially supports Python 3.10+.\n- Do not add query strings to URLs by hand or form-encode `PUT`/`POST` data yourself. The README says there is no need, and for JSON it says \"nowadays, just use the `json` method!\"\n- For basic auth, pass `auth=('user', 'pass')` to the request call, as the README example does.\n- Do not write your own keep-alive or connection pooling. The docs say both are \"100% automatic, thanks to urllib3\".\n- Before handling cookies across requests by hand, read the docs' Session Objects section. The docs list \"Sessions with Cookie Persistence\" as a feature.\n- If the code needs concurrent requests, read the docs' \"Blocking Or Non-Blocking?\" section first.\n"
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "requests.get(url) with no timeout",
       "fix": "requests.get(url, timeout=5) or timeout=(3.05, 27) for separate connect and read limits",
       "why": "Without a timeout a request can wait forever; in our run timeout=1 against a 3-second server raised ReadTimeout as expected."
      },
      {
       "dont": "requests.post(url, data=json.dumps(payload))",
       "fix": "requests.post(url, json=payload)",
       "why": "data= with a string sends no Content-Type, so many services reject it; in our run data= gave Content-Type None, json= gave application/json."
      },
      {
       "dont": "data = r.json() right after the call, treating it as success",
       "fix": "Call r.raise_for_status() (or check r.status_code) first, then r.json()",
       "why": "Error answers can carry a JSON body too, and r.json() decodes it without complaint."
      },
      {
       "dont": "verify=False to get past a certificate error",
       "fix": "Keep verify=True and point verify= or REQUESTS_CA_BUNDLE at the right CA file; upgrade certifi",
       "why": "verify=False accepts any certificate and opens the app to man-in-the-middle attacks."
      },
      {
       "dont": "pip install types-requests next to requests 2.34+, or a custom HTTPAdapter overriding _get_connection",
       "fix": "Drop types-requests (requests ships its own types since 2.34.0); override get_connection_with_tls_context in adapters",
       "why": "The typing stubs moved into the package in 2.34.0, and the adapter hook was renamed in 2.32.2."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Can I use it in a paid, closed-source app?",
       "a": "Yes. The Apache-2.0 license allows commercial use; keep the license text if you ship the library with your app.",
       "evidence": {
        "url": "https://github.com/psf/requests/blob/main/LICENSE",
        "quote": "You must give any other recipients of the Work or Derivative Works a copy of this License"
       }
      },
      {
       "q": "Does it retry failed requests by itself?",
       "a": "No. You add retries with urllib3's Retry class mounted on a Session.",
       "evidence": {
        "url": "https://requests.readthedocs.io/en/latest/user/advanced/",
        "quote": "By default, Requests does not retry failed connections."
       }
      },
      {
       "q": "Does r.json() working mean the request succeeded?",
       "a": "No. A server can send an error with a JSON body; check r.raise_for_status() or the status code.",
       "evidence": {
        "url": "https://requests.readthedocs.io/en/latest/user/quickstart/",
        "quote": "It should be noted that the success of the call to r.json() does not indicate the success of the response."
       }
      },
      {
       "q": "Can it do async calls?",
       "a": "Not with its default setup; every call blocks. The docs mention httpx and other projects for that.",
       "evidence": {
        "url": "https://requests.readthedocs.io/en/latest/user/advanced/",
        "quote": "With the default Transport Adapter in place, Requests does not provide any kind of non-blocking IO."
       }
      },
      {
       "q": "Does it support SOCKS proxies?",
       "a": "Yes, after installing the extra requests[socks].",
       "evidence": {
        "url": "https://requests.readthedocs.io/en/latest/user/advanced/",
        "quote": "This is an optional feature that requires that additional third-party libraries be installed before use."
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "pypi requests"
  ],
  [
   "Category",
   "HTTP clients and networking"
  ],
  [
   "License",
   "Apache-2.0"
  ],
  [
   "Latest version",
   "v2.34.2, May 14, 2026"
  ],
  [
   "On GitHub since",
   "February 2011"
  ],
  [
   "Gid Score",
   "88.0"
  ],
  [
   "Rank in category",
   "#2 of 126"
  ],
  [
   "GitHub",
   "psf/requests"
  ],
  [
   "Last change",
   "Nov 2, 2026"
  ]
 ],
 "good": [
  "It needs Python 3.10 or newer; version 2.33.0 dropped Python 3.9.",
  "By default a request never gives up waiting. Set a timeout on every call, or a stuck service can freeze your script.",
  "Each call waits for its answer before the program goes on. For many calls at the same time, the docs point to other tools such as httpx."
 ],
 "checked_line": "Read by AgentGid from 11 official pages, card checked Nov 10, 2026; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/psf.png"
}