Skip to content

Instantly share code, notes, and snippets.

@twaddington
Created March 1, 2011 06:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save twaddington/848725 to your computer and use it in GitHub Desktop.
Save twaddington/848725 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from urllib import urlopen, quote
url = 'http://www.example.com/example.jpg'
# Check valid url
resource = urlopen(url)
status = resource.getcode()
content_type = resource.info().get('Content-Type')
# Print result
print '%d: %s at %s\n' % (status, content_type, url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment