From 62b276701e9c7c83e1e97c130015082dd9dd39a0 Mon Sep 17 00:00:00 2001 From: Michael Rice Date: Sun, 4 Aug 2013 20:47:18 -0500 Subject: [PATCH] added try except to urllib2 call for cal data --- gitfiti.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gitfiti.py b/gitfiti.py index eacd950cc..6f92d63bc 100755 --- a/gitfiti.py +++ b/gitfiti.py @@ -167,7 +167,12 @@ def load_images(img_names): def get_calendar(username, base_url='https://github.com/'): """retrieves the github commit calendar data for a username""" url = base_url + 'users/' + username + '/contributions_calendar_data' - page = urllib2.urlopen(url) + try: + page = urllib2.urlopen(url) + except (urllib2.HTTPError,urllib2.URLError) as e: + print "There was a problem fetching data from {0}".format(url) + print e + raise SystemExit return json.load(page) def max_commits(input):