2 ms·
Uh couldn't you use the Events API to more efficiently go through someone's recent commits? def findEmailFromContributor(username, repo, contributor):
by danso 2y ago
Uh couldn't you use the Events API to more efficiently go through someone's recent commits?
def findEmailFromContributor(username, repo, contributor):
response = requests.get('https://github.com/%s/%s/commits?author=%s' % (username, repo, contributor), auth=HTTPBasicAuth(username, '')).text
latestCommit = re.search(r'href="/%s/%s/commit/(.*?)"' % (username, repo), response)
if latestCommit:
latestCommit = latestCommit.group(1)
else:
latestCommit = 'dummy'
commitDetails = requests.get('https://github.com/%s/%s/commit/%s.patch' % (username, repo, latestCommit), auth=HTTPBasicAuth(username, '')).text
email = re.search(r'<(.*)>', commitDetails)