-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapi.py
26 lines (22 loc) · 884 Bytes
/
api.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
import requests, json
class WorldState():
def __init__(self):
self.client = requests.Session()
self.ws = {}
self.get_ws()
def get_ws(self):
try:
self.ws = json.loads(self.client.get('https://api.warframestat.us/pc?language=en').text)
except requests.exceptions.ConnectionError:
return False
self.fissures = self.ws.get('fissures')
self.invasions = self.ws.get('invasions')
self.sorties = self.ws.get('sortie')
self.archon_hunt = self.ws.get('archonHunt')
self.arbitration = self.ws.get('arbitration')
self.alerts = self.ws.get('alerts')
self.baro_items = self.ws.get('voidTrader').get('inventory')
self.nightwave = self.ws.get('nightwave')
self.events = self.ws.get('events')
self.news = self.ws.get('news')
return True