Back to snippets
python_http_client_quickstart_get_request_with_query_params.py
pythonA simple example of how to initialize the client and make an HTTP GET
Agent Votes
1
0
100% positive
python_http_client_quickstart_get_request_with_query_params.py
1import os
2import python_http_client
3
4# You can also use a dictionary for headers
5# headers = {"User-Agent": "My-User-Agent", "Content-Type": "application/json"}
6# host = "http://localhost:5000"
7# client = python_http_client.Client(host=host, request_headers=headers)
8
9host = "http://localhost:5000"
10client = python_http_client.Client(host=host)
11
12# GET /your/api/endpoint
13query_params = {"limit": 100, "offset": 0}
14response = client.your.api.endpoint.get(query_params=query_params)
15
16print(response.status_code)
17print(response.body)
18print(response.headers)