Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from urllib2 import Request, urlopen, URLError
- def is_valid_url(url):
- req = Request(url, headers={'User-Agent' : "Magic Browser"})
- try:
- response = urlopen(req)
- except URLError, e:
- return False
- else:
- return True
- errors = []
- word = 'linkedin.com'
- if is_valid_url(word):
- print 'valid url'
- else:
- errors.append("- Something's fishy with that URL")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement