Skip to content

Instantly share code, notes, and snippets.

@Averroes
Created April 10, 2015 17:18
Show Gist options
  • Select an option

  • Save Averroes/1d511ad09a068f0c1327 to your computer and use it in GitHub Desktop.

Select an option

Save Averroes/1d511ad09a068f0c1327 to your computer and use it in GitHub Desktop.
interacting with http services as a client
# Example of a HEAD request
import requests
resp = requests.head('http://www.python.org/index.html')
status = resp.status_code
last_modified = resp.headers['last-modified']
content_type = resp.headers['content-type']
content_length = resp.headers['content-length']
print(status)
print(last_modified)
print(content_type)
print(content_length)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment