added try except to urllib2 call for cal data

This commit is contained in:
Michael Rice
2013-08-04 20:47:18 -05:00
parent 3af9779d31
commit 62b276701e

View File

@ -167,7 +167,12 @@ def load_images(img_names):
def get_calendar(username, base_url='https://github.com/'): def get_calendar(username, base_url='https://github.com/'):
"""retrieves the github commit calendar data for a username""" """retrieves the github commit calendar data for a username"""
url = base_url + 'users/' + username + '/contributions_calendar_data' 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) return json.load(page)
def max_commits(input): def max_commits(input):