{"id":20710026,"url":"https://github.com/oxylabs/python-requests","last_synced_at":"2026-04-17T06:32:53.233Z","repository":{"id":134336658,"uuid":"554181012","full_name":"oxylabs/python-requests","owner":"oxylabs","description":"Learn how to use Python Requests module","archived":false,"fork":false,"pushed_at":"2025-02-11T12:56:57.000Z","size":10,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-11T05:48:51.989Z","etag":null,"topics":["get-request-python","github-python","http-client","json","python","python-ecommerce","python-library","python-web-crawler","requests","scraper-python","serp-api-python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oxylabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-10-19T11:39:24.000Z","updated_at":"2025-02-11T12:57:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"feba83a9-5e65-4d5a-83f0-e9ebfb8dce1a","html_url":"https://github.com/oxylabs/python-requests","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/oxylabs/python-requests","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxylabs%2Fpython-requests","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxylabs%2Fpython-requests/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxylabs%2Fpython-requests/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxylabs%2Fpython-requests/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oxylabs","download_url":"https://codeload.github.com/oxylabs/python-requests/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oxylabs%2Fpython-requests/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273548857,"owners_count":25125256,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-04T02:00:08.968Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["get-request-python","github-python","http-client","json","python","python-ecommerce","python-library","python-web-crawler","requests","scraper-python","serp-api-python"],"created_at":"2024-11-17T02:09:35.091Z","updated_at":"2025-10-05T03:26:13.687Z","avatar_url":"https://github.com/oxylabs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Python Requests Library\n\n[![Oxylabs promo code](https://raw.githubusercontent.com/oxylabs/product-integrations/refs/heads/master/Affiliate-Universal-1090x275.png)](https://oxylabs.io/pages/gitoxy?utm_source=877\u0026utm_medium=affiliate\u0026groupid=877\u0026utm_content=python-requests-github\u0026transaction_id=102f49063ab94276ae8f116d224b67)\n\n[![](https://dcbadge.limes.pink/api/server/Pds3gBmKMH?style=for-the-badge\u0026theme=discord)](https://discord.gg/Pds3gBmKMH) [![YouTube](https://img.shields.io/badge/YouTube-Oxylabs-red?style=for-the-badge\u0026logo=youtube\u0026logoColor=white)](https://www.youtube.com/@oxylabs)\n\n[\u003cimg src=\"https://img.shields.io/static/v1?label=\u0026message=Requets\u0026color=brightgreen\" /\u003e](https://github.com/topics/requests) [\u003cimg src=\"https://img.shields.io/static/v1?label=\u0026message=Python\u0026color=important\" /\u003e](https://github.com/topics/python)\n\n- [Getting started with Requests](#getting-started-with-requests)\n- [Python requests: GET](#python-requests-get)\n- [Reading responses](#reading-responses)\n- [Using Python request headers](#using-python-request-headers)\n- [Python requests: POST](#python-requests-post)\n\nThe **Requests** module is one widely used to send HTTP requests. It’s a third-party alternative to the standard [urllib](https://docs.python.org/3/library/urllib.html), [urllib2](https://docs.python.org/2/library/urllib2.html), and [urllib3](https://urllib3.readthedocs.io/en/latest/) as they can be confusing and often need to be used together. **Requests** in Python greatly simplifies sending HTTP requests to their destination.\n\nThis article gives you an overview of everything you need about Requests.\n\nFor a detailed explanation, see our [blog post](https://oxylabs.io/blog/python-requests).\n\n## Getting started with Requests\n\nInstalling Requests is simple as it can be done through a terminal.  \n\n```shell\n$ pip install requests\n```\n\nFinally, before beginning to use Requests in any project, the library needs to be imported:\n\n```python\nimport requests\n```\n\n## Python requests: GET\n\nTo send a GET request, invoke `requests.get()` in Python and add a destination URL, as follows:  \n\n```python\nimport requests\nrequests.get('http://httpbin.org/')\n```\n\nGET requests can be sent with specific parameters if required:  \n\n```python\npayload = {'key1': 'value1', 'key2': 'value2'}\nrequests.get('http://httpbin.org/', params=payload)\n```\n\n## Reading responses\n\n```python\nresponse = requests.get('http://httpbin.org/')\nprint(response.status_code)\n\n# OUTPUT: \u003cResponse [200]\u003e\n```\n\nTo read the content of the response, we need to access the text part by using `response.text`:  \n\n```python\nprint(response.text)\n```\n\nResponses can also be decoded to the JSON format:\n\n```python\nresponse = requests.get('http://api.github.com')\nprint(response.json())\n```\n\n## Using Python request headers\n\nResponse headers are another important part of the request:  \n\n```python\nprint(response.headers)\n```\n\nYou can also send custom Python request headers. To check whether our request header has been sent successfully, we will need to make the call `response.request.headers`:  \n\n```python\nimport requests\n\nheaders = {'user-agent': 'my-agent/1.0.1'}\nresponse = requests.get('http://httpbin.org/', headers=headers)\nprint(response.request.headers)\n```\n\n## Python requests: POST\n\nSending a POST request is *almost* as simple as sending a GET:  \n\n```python\nresponse = requests.post('https://httpbin.org/post', data = {'key':'value'})\n```\n\nThe requests library accepts arguments from dictionary objects which can be utilized to send more advanced data:\n\n```python\npayload = {'key1': 'value1', 'key2': 'value2'}\nresponse = requests.post('https://httpbin.org/post', data = payload)\n```\n\nRequests have an added feature that automatically converts the POST request data into JSON.\n\n```python\nimport requests\n\npayload = {'key1': 'value1', 'key2': 'value2'}\nresponse = requests.post('https://httpbin.org/post', json = payload)\nprint(response.json())\n```\n\nAlternatively, the *json* library might be used to convert dictionaries into JSON objects:\n\n```python\nimport json\nimport requests\n\npayload = {\n    'key1': 'value1',\n    'key2': 'value2'}\njsonData = json.dumps(payload)\nresponse = requests.post('https://httpbin.org/post', data = jsonData)\nprint(response.json())\n```\n\nIf you wish to learn more about Requests, see our [blog post](https://oxylabs.io/blog/python-requests).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxylabs%2Fpython-requests","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foxylabs%2Fpython-requests","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foxylabs%2Fpython-requests/lists"}