diff --git a/github.py b/github.py index 28bf03d..1cd54ed 100644 --- a/github.py +++ b/github.py @@ -7,8 +7,13 @@ with requests.Session() as session: session.auth = (config.user, config.password) + def get_repos(since=0): + """ + Place Holder Comment + """ url = 'http://api.github.com/repositories' + data = """{ since: %s }""" % since @@ -25,12 +30,17 @@ def get_repos(since=0): def get_repo(url): + """ + Returns the array of .json files of the current repository + """ response = session.get(url) return response.json() def get_read_me(url): - # Grabs the readme file associated with the current repository + """ + Returns the repository's readme file + """ url += '/readme' response = session.get(url) return response.json() @@ -38,12 +48,30 @@ def get_read_me(url): # todo: return array of all commits so we can examine each one def get_repo_sha(url): + """ + Returns the last commit's SHA + """ # /repos/:owner/:repo/commits commits = session.get(url + '/commits').json() return commits[0]['sha'] + # todo: This function should return an all of all the Commits + def get_all_repo_sha(url): + """ + Return a list of all commit's SHA + """ + commits = session.get(url + '/commits').json() + all_sha = [] + for x in range(len(commits)): + all_sha[x] = commits[x]['sha'] + return all_sha + + def get_file_content(item): + """ + Place Holder Comment + """ ignore_extensions = ['jpg'] filename, extension = os.path.splitext(item['path']) if extension in ignore_extensions: @@ -57,6 +85,9 @@ def get_file_content(item): def get_repo_contents(url, sha): + """ + Place Holder Comment + """ # /repos/:owner/:repo/git/trees/:sha?recursive=1 url += '/git/trees/%s?recursive=1' % sha # print 'url', url