'Using Pygithub to search code and identify author
Does anyone have a recommendation how how I can perform a string search in Github code, identify files matching the string in code and then identify the owner of the code file?
This function allows me to search code, but I can't figure out how to identify the author/owner.
def search_github(keyword):
#rate_limit = g.get_rate_limit()
#rate = rate_limit.search
#if rate.remaining == 0:
# print(f'You have 0/{rate.limit} API calls remaining.
Reset time: {rate.reset}')
# return
#else:
# print(f'You have {rate.remaining}/{rate.limit} API
calls remaining')
query = f'"{keyword}"'
result = g.search_code(query, order='desc')
max_size = 100
print(f'Found {result.totalCount} file(s)')
if result.totalCount > max_size:
result = result[:max_size]
for file in result:
print(f'{file.download_url}')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
