Guest User

Untitled

a guest
May 18th, 2015
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. lastTime = time.time()
  2. regionIds = [10000002] # REGIONID LIST GOES HERE
  3. typeIds = [198] # TYPEID LIST GOES HERE
  4. for regionId in regionIds:
  5. for typeId in typeIds:
  6. try:
  7. url = 'https://public-crest.eveonline.com/market/%i/types/%i/history/' % (regionId, typeId)
  8. resp = urllib2.urlopen(url, timeout=10)
  9. hist = json.load(resp)
  10. turnover = sum(map(lambda x: x['avgPrice'] * x['volume'], hist['items'])) if hist['totalCount'] > 0 else 0
  11. except Exception as e:
  12. # Handle exceptions
  13. pass
  14. nextTime = lastTime + 1.0 / 25.0
  15. time.sleep(max(0.0, nextTime - time.time()))
  16. lastTime = nextTime
Advertisement
Add Comment
Please, Sign In to add comment