-
Notifications
You must be signed in to change notification settings - Fork 0
/
4get_champion_info.py
44 lines (32 loc) · 896 Bytes
/
4get_champion_info.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
from riotwatcher import RiotWatcher
import pymongo
import time
from requests import HTTPError
keys=['YOUR-API-KEY']
host='localhost'
port= 27017
my_region = 'na1'
client=pymongo.MongoClient(host,port)
db= client['db']
sheet0=db['userinfo_v1']
sheet=db['userinfo_v2']
j=0
watcher = RiotWatcher(keys[0])
for item in sheet0.find():
accountId=item['accountId']
if item['flag']==0 and item['task']==0:
try:
time.sleep(0.1)
matchlist = watcher.match.matchlist_by_account(my_region, account_id=accountId, season=9)['matches']
dic=item
dic['matchlist']=matchlist
sheet.insert_one(dic)
sheet0.update(
{'_id':item['_id']},
{'$set':{'flag':1}}
)
j+=1
print(j)
except:
print('wrong')
continue