Python Get Request with Query Parameters Example

23-Aug-2022

.

Admin

Python Get Request with Query Parameters Example

Hi Dev,

This tutorial is focused on Python Get Request With Query Parameters Example. you will learn Python Http Get Request Json. you'll learn Python Http Get Request With Parameters Example. I would like to share with you Python Get Request With Body.

Here, we will use requests library to all GET HTTP Request and get json data in python program. i will give you very simple example to call GET Request with body parameters in python.

so let's see following examples with output:

Example 1: Python GET Request Example


main.py

import requests

# GET Request API URL

url = 'https://reqres.in/api/users'

response = requests.get(url)

# GET JSON Data from API

data = response.json()

print(data)

Output:

Example 2: Python GET Request with Parameters Example

main.py

import requests

# GET Request API URL

url = 'https://reqres.in/api/users'

# Adding Parameters

params = dict(

page=1,

)

response = requests.get(url, params)

# GET JSON Data from API

data = response.json()

print(data)

Output:

#Python