· 5 years ago · May 05, 2020, 05:24 PM
1import requests
2import json
3
4api = '****************************'
5
6response = requests.get('https://market.csgo.com/api/v2/my-inventory/?key=' + f'{api}')
7b = response.json()
8
9
10print(b)
11
12userData = json.load((open('C:\\pytest\\api.json')))
13
14userData.update(b)
15with open('C:\\pytest\\api.json', 'w') as file:
16 json.dump(userData, file, indent=4)
17 file.close()
18
19
20classid = userData['items'][0]['classid']
21print(classid)
22
23instanceid = userData['items'][0]['instanceid']
24print(instanceid)
25
26
27response2 = requests.get('https://market.csgo.com/api/ItemHistory/' + f'{classid}' + '_' + f'{instanceid}' + '/?key=' + f'{api}')
28b2 = response2.json()
29print(b2)