Browse files

Custom user-agent for site-up.

  • Loading branch information...
1 parent da55aaf commit b57b4d8493563167ed2304e079b6c32f5710f957 @spladug spladug committed Mar 30, 2012
Showing with 4 additions and 1 deletion.
  1. +4 −1 site_up.py
View
5 site_up.py
@@ -18,10 +18,13 @@ def monitor_site(url):
tag = urlparse.urlparse(url).hostname
local_name = platform.node()
+ request = urllib2.Request(url)
+ request.add_header("User-Agent", "site-up monitor by /u/spladug")
+
recent_failures = 0
while True:
try:
- urllib2.urlopen(url, timeout=TIMEOUT)
+ urllib2.urlopen(request, timeout=TIMEOUT)
except urllib2.URLError:
recent_failures += 1

0 comments on commit b57b4d8

Please sign in to comment.