Created
March 1, 2011 06:35
-
-
Save twaddington/848725 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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