private profile info hidden -> error fixed

This commit is contained in:
pseusys
2023-02-02 11:09:11 +01:00
parent bd14f65072
commit 87ec6c1b5a

View File

@@ -442,10 +442,10 @@ def get_short_info(github):
else: else:
disk_usage = humanize.naturalsize(user_info.disk_usage) disk_usage = humanize.naturalsize(user_info.disk_usage)
request = requests.get('https://github-contributions.vercel.app/api/v1/' + user_info.login) request = requests.get('https://github-contributions.vercel.app/api/v1/' + user_info.login)
if request.status_code == 200: if request.status_code == 200 and len(request.json()['years']) > 0:
data = request.json() this_year_data = request.json()['years'][0]
total = data['years'][0]['total'] total = this_year_data['total']
year = data['years'][0]['year'] year = this_year_data['year']
string += '> 🏆 ' + translate['Contributions in the year'] % (humanize.intcomma(total), year) + '\n > \n' string += '> 🏆 ' + translate['Contributions in the year'] % (humanize.intcomma(total), year) + '\n > \n'
string += '> 📦 ' + translate["Used in GitHub's Storage"] % disk_usage + ' \n > \n' string += '> 📦 ' + translate["Used in GitHub's Storage"] % disk_usage + ' \n > \n'