forked from PaxxPatriot/skinport.py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebug.py
31 lines (23 loc) · 799 Bytes
/
debug.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
import asyncio
import logging
import skinport
from collections import Counter
logger = logging.getLogger("skinport")
logger.setLevel(logging.DEBUG)
handler = logging.FileHandler(filename="skinport.log", encoding="utf-8", mode="w")
handler.setFormatter(logging.Formatter("%(asctime)s:%(levelname)s:%(name)s: %(message)s"))
logger.addHandler(handler)
skinport_client = skinport.Client()
c = Counter()
@skinport_client.listen("saleFeed")
async def on_sale_feed(data):
print("New Event")
salefeed = skinport.SaleFeed(data=data)
for item in salefeed.sales:
c[item.quality] += 1
if __name__ == "__main__":
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
try:
skinport_client.run(app_id=skinport.AppID.dota2)
finally:
print(c)