E-mail : support@tech2now.in

Rest API Call in Python

We can use http. client module to call rest API. See the below example for this.

import http.client

conn = http.client.HTTPSConnection("api.xyz.com")
payload = ''
headers = {}
conn.request("GET", "/?name=anupam", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

GitHub Repository URL (Source code)