-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathupdate.py
More file actions
28 lines (23 loc) · 707 Bytes
/
update.py
File metadata and controls
28 lines (23 loc) · 707 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
# connect to db
# get keys list
# for each key perform update
from app import Keys, db
from swaper import Yolo, BitapiException
import time
import logging
#logging.basicConfig(level=logging.DEBUG)
k = Keys.query.all()
for i in k:
try:
y = Yolo(key=i.public_key, secret=i.private_key)
print y.cancel_all()
print y.make_best()
except BitapiException as e:
print(e.args[0])
if e.args[0]['errorMsg'] == 'Invalid API key':
print "Key to be removed :_: "
Keys.query.filter_by(private_key=i.private_key).delete()
db.session.commit()
except Exception as e:
logging.exception('General Exception')
# print e