From http://docs.python-requests.org/en/latest/user/quickstart/
url = 'https://api.github.com/some/endpoint' payload = {'some': 'data'} headers = {'content-type': 'application/json'} r = requests.post(url, data=json.dumps(payload), headers=headers)
You just need to create a dict with your headers (key: value pairs, where key is the name of the header and value is the value of the pair) and pass that dict to the headers parameter on .get or .post .
So a more specific question:
headers = {'foobar': 'raboof'} requests.get('http://himom.com', headers=headers)
tkone Dec 31 2018-11-12T00: 00Z
source share