EzDevInfo.com

PyGithub

Python library implementing the GitHub API v3

Get Latest Commit URL from PyGithub Efficiently

I'm using this function to get the latest commit url using PyGithub:

from github import Github

def getLastCommitURL():
    encrypted = 'mypassword'
    # naiveDecrypt defined elsewhere
    g = Github('myusername', naiveDecrypt(encrypted))
    org = g.get_organization('mycompany')
    code = org.get_repo('therepo')
    commits = code.get_commits()
    last = commits[0]
    return last.html_url

It works but it seems to make Github unhappy with my IP address and give me a slow response for the resulting url. Is there a more efficient way for me to do this?


Source: (StackOverflow)