Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lastTime = time.time()
- regionIds = [10000002] # REGIONID LIST GOES HERE
- typeIds = [198] # TYPEID LIST GOES HERE
- for regionId in regionIds:
- for typeId in typeIds:
- try:
- url = 'https://public-crest.eveonline.com/market/%i/types/%i/history/' % (regionId, typeId)
- resp = urllib2.urlopen(url, timeout=10)
- hist = json.load(resp)
- turnover = sum(map(lambda x: x['avgPrice'] * x['volume'], hist['items'])) if hist['totalCount'] > 0 else 0
- except Exception as e:
- # Handle exceptions
- pass
- nextTime = lastTime + 1.0 / 25.0
- time.sleep(max(0.0, nextTime - time.time()))
- lastTime = nextTime
Advertisement
Add Comment
Please, Sign In to add comment