python-requests Getting started with python-requests GET requests


Example

requests.get() creates a GET request:

response = requests.get('https://example.com/')

Pass in query parameters as a dictionary to the params argument:

response = requests.get('https://example.com/', params={"a": 1, "b": 2})

For GET requests that might require basic authentication, you can include the auth paramter as follows:

response = requests.get('https://api.github.com/user', auth=('user', 'pass'))