From 68a1fb2b031bcd605e027cc45cf1d4ee3637211e Mon Sep 17 00:00:00 2001 From: Jochen Kupperschmidt Date: Sun, 5 Jun 2016 23:20:31 +0200 Subject: [PATCH] Extracted "constant" for GitHub base URL. --- gitfiti.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gitfiti.py b/gitfiti.py index ed8d128bc..a84c5295b 100755 --- a/gitfiti.py +++ b/gitfiti.py @@ -16,6 +16,9 @@ import math import urllib2 +GITHUB_BASE_URL = 'https://github.com/' + + TITLE = ''' _ __ _____ __ _ ____ _(_) /_/ __(_) /_(_) @@ -190,7 +193,7 @@ def load_images(img_names): return loaded_imgs -def get_calendar(username, base_url='https://github.com/'): +def get_calendar(username, base_url=GITHUB_BASE_URL): """retrieves the GitHub commit calendar data for a username""" base_url = base_url + 'users/' + username @@ -316,13 +319,14 @@ def main(): print(TITLE) print('Enter GitHub URL') - ghe = request_user_input('Enter nothing for https://github.com/ to be used: ') + ghe = request_user_input('Enter nothing for {} to be used: ' + .format(GITHUB_BASE_URL)) print('Enter your GitHub username:') username = request_user_input() if not ghe: - git_base = 'https://github.com/' + git_base = GITHUB_BASE_URL cal = get_calendar(username) else: cal = get_calendar(username, base_url=ghe)