Skip to content

Instantly share code, notes, and snippets.

@kashifpk
Created September 3, 2016 00:17
Show Gist options
  • Save kashifpk/7e120c7493a2b68f0fd3120962d3bf77 to your computer and use it in GitHub Desktop.
Save kashifpk/7e120c7493a2b68f0fd3120962d3bf77 to your computer and use it in GitHub Desktop.
from requests import Request, Session
req = Request('GET', 'http://[::1]')
s = Session()
prep = req.prepare()
prep.prepare_headers({'host': '::1'})
resp = s.send(prep)
print(resp.status_code)
print(resp.text)
@kashifpk
Copy link
Author

kashifpk commented Sep 3, 2016

Or simply::

import requests
requests.get('http://[::1]', headers={'host': '::1'})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment