Python HTML Get Parameter

Rate this post

Problem Formulation: How to perform an HTTP get call in Python?

Python HTML Get Parameter Gif

Solution: Use Python’s requests library.

import requests
payload = {'param_1': 'value_1', 'param_2': 'value_2'}
r = requests.get('', params=payload)

This is semantically equivalent to issuing an HTTP get call:

In fact, you can obtain this exact URL by using the r.url attribute on the request object:


You can find the text response by using the r.text attribute of the request object:

# [... return value from server ...]

Alternatively, if you expect a json object, you can also do:

# [{... returned json object ... }]

Try it yourself in our interactive Jupyter Notebook with Google Colab: