-
Notifications
You must be signed in to change notification settings - Fork 0
/
GetAllPros.py
43 lines (38 loc) · 1.41 KB
/
GetAllPros.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import requests
import urllib.parse
import json
import datetime as dt
import pandas as pd
#dt.date.today().ctime()
allProsURL = 'https://www.trackingthepros.com/d/list_players'
response = requests.get(allProsURL)
json_object = response.json()
df = pd.DataFrame(columns=('Pro Name',
'Team',
'Server',
'AccName',
'CurRank',
'GetTime'))
for data in json_object['data']:
count=1
proID = data['DT_RowId']
ProURL = 'https://www.trackingthepros.com/d/list_accounts?id={}'.format(proID)
response = requests.get(ProURL)
json_object2 = response.json()
ProName = data['name']
TeamName = data['team']
print('\nTeam: {}'.format(ProName))
print('Name: {}'.format(TeamName))
for item in json_object2['data']:
df = df.append({'Pro Name' : ProName,
'Team' : TeamName,
'Server' : item['server'] ,
'AccName' : item['name'] ,
'CurRank' : item['rankCombined'],
'GetTime':dt.date.today().ctime()},
ignore_index=True)
print(" {} Account #{} : {} ".format(item['server'],count,item['name']))
print(" Rank : {} \n".format(item['rankCombined']))
count+=1
print(df.head())
df.to_csv(r'C:\Users\angeloc\Desktop\trackingthepros.csv')