Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions docs/user/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,25 @@ OPTIONS? These are all just as simple::
>>> r = requests.head('https://httpbin.org/get')
>>> r = requests.options('https://httpbin.org/get')

That's all well and good, but it's also only the start of what Requests can
do.
You can also specify **custom headers** while making a request, for example:

.. code-block:: python

import requests

url = "https://httpbin.org/get"
headers = {"User-Agent": "MyApp/1.0"}
response = requests.get(url, headers=headers)
print(response.status_code)
print(response.json())

>>> import requests
>>> try:
... r = requests.get('https://httpbin.org/delay/3', timeout=2)
... except requests.exceptions.Timeout:
... print("The request timed out")
... else:
... print("Request completed successfully:", r.status_code)


Passing Parameters In URLs
Expand Down