-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_progress.py
More file actions
32 lines (22 loc) · 936 Bytes
/
get_progress.py
File metadata and controls
32 lines (22 loc) · 936 Bytes
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
30
31
32
import requests
import json
#1 = xbox
#2 = psn
membershipType = 1
HEADERS = {"X-API-Key":'put your api thingy here'}
def get_userids(username):
api_url = "https://www.bungie.net/Platform/Destiny2/SearchDestinyPlayer/%s/%s/" % (membershipType,username)
res = requests.get(api_url, headers=HEADERS)
error_stat = res.json()['ErrorStatus']
if error_stat != "Success":
print("Error status: " + error_stat + "\n")
return False
return res.json()["Response"][0]["membershipId"]
userid = get_userids("spiffomatic64")
api_url = "https://www.bungie.net/Platform/Destiny2/%s/Profile/%s/?components=Characters,CharacterProgressions" % (membershipType,userid)
res = requests.get(api_url, headers=HEADERS)
print(res)
error_stat = res.json()['ErrorStatus']
if error_stat != "Success":
print("Error status: " + error_stat + "\n")
print(json.dumps(res.json(), indent=4, sort_keys=True))