Skip to content

Commit

Permalink
Spoof user agent header
Browse files Browse the repository at this point in the history
Closes #84.
  • Loading branch information
laraross authored and suchow committed Sep 28, 2015
1 parent f884ec7 commit 9a0e539
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ $1000 USD
www.google.com
http://broken.lifelinter.com
http://news.ycombinator.com
http://tutsplus.com

# Grammar
the the meter is is great
Expand Down
3 changes: 2 additions & 1 deletion proselint/checks/misc/linkchecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ def check(blob):
def is_broken_link(url):
"""Check if the link return a 404 error."""
try:
urllib2.urlopen(url, timeout=2)
request = urllib2.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
urllib2.urlopen(request).read()
return False
except urllib2.URLError:
return True
Expand Down

0 comments on commit 9a0e539

Please sign in to comment.