Simplify logic to check default branch

This commit is contained in:
Aadit Rahul Kamat
2020-12-29 14:23:08 +08:00
parent 96f79dc767
commit 6e68caad61

View File

@@ -454,11 +454,7 @@ def get_stats(github):
yearly_data = loc.calculateLoc()
loc.plotLoc(yearly_data)
stats += '**' + translate['Timeline'] + '**\n\n'
try:
github.get_repo(f'{username}/{username}').get_branch('main')
branch_name = 'main'
except GithubException:
branch_name = 'master'
branch_name = github.get_repo(f'{username}/{username}').default_branch
stats = stats + '![Chart not found](https://raw.githubusercontent.com/' + username + '/' + username + '/' + branch_name + '/charts/bar_graph.png) \n\n'
return stats