-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdl_counters.py
executable file
·29 lines (24 loc) · 976 Bytes
/
dl_counters.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python3
import os, requests
def main():
print('itch.io:')
resp = requests.get('https://itch.io/api/1/key/my-games',
headers={'Authorization': 'Bearer ' + os.environ['ITCHIO_API_KEY']})
resp.raise_for_status()
for game in resp.json()['games']:
if game['title'] == 'Undying Dusk':
print(' Views:', game['views_count'])
print(' Downloads:', game['downloads_count'])
print(' Purchases:', game['purchases_count'])
print(' Earnings:', game['earnings'][0]['amount_formatted'])
print()
print('GitHub:')
resp = requests.get('https://api.github.com/repos/Lucas-C/undying-dusk/releases')
resp.raise_for_status()
for release in resp.json():
print(release['tag_name'], 'downloads:')
for asset in release['assets']:
print(' ', asset['name'], asset['download_count'])
print()
if __name__ == '__main__':
main()