Advertisement
Guest User

Untitled

a guest
Jan 28th, 2016
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. import urllib3
  2. urllib3.disable_warnings()
  3.  
  4. import swagger_client
  5. import pprint
  6. import time
  7.  
  8. swagger_client.configuration.username = 'workwave_user_sh'
  9. swagger_client.configuration.password = 'workwave2055'
  10.  
  11. HOST = "https://gps-api.foxtraxgps.com/gps/api/v0"
  12. api_client = swagger_client.ApiClient(HOST)
  13. gps_api = swagger_client.GPSApi(api_client)
  14.  
  15. def chunk_list(list_, chunk_size):
  16. for element in xrange(0, len(list_), chunk_size):
  17. yield list_[element:element+chunk_size]
  18.  
  19. def get_stop_reports():
  20. count = 0
  21. devices = gps_api.devices_get()
  22. #pprint.pprint(devices)
  23. for device_chunk in chunk_list(devices.device_info, 10):
  24. device_id_list = ','.join([str(d.device_id) for d in device_chunk])
  25. rpt = gps_api.reports_stops_get(device_ids=device_id_list)
  26. pprint.pprint(rpt)
  27.  
  28.  
  29. get_stop_reports()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement