Python GET Request with Parameters

Python GET Request with Parameters

This article will provide example of python http get request with parameters example. In this article, we will implement a python get request with query parameters.

I would like to share with you python get request example. Here, Creating a basic example of 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.

You can use these examples with python3 (Python 3) version.

let’s see below simple examples :


Example 1 :

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) 

Python GET Request with Parameters

Example 2 : Python GET Request with Parameter

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) 

I hope you like this article.😊

Also Read :