import time import pprint from we_connect import wci from credentials import user, password from we_connect.domains import Domain def main(): w = wci.WeConnectId(user, password) vehicles = w.get('/vehicles') print('list of vehicles:') for key in vehicles: print(key) pprint.pprint(vehicles) domains = [Domain.ALL_CAPABLE] endpoint = '/vehicles/' + vehicles['data'][0]['vin'] + '/selectivestatus?jobs=' count = len(domains) for domain in domains: endpoint += domain.value count -= 1 if count > 0: endpoint += ',' # endpoint = '/vehicles/' + vehicles['data'][0]['vin'] + f'/selectivestatus?jobs=access,charging,climatisation,climatisationTimers,fuelStatus,userCapabilities,vehicleLights,vehicleHealthInspection,oilLevel,measurements' print(f'Endpoint: {endpoint}') while True: start = time.time() try: data = w.get(endpoint) print(data) except Exception: pass stop = time.time() diff = stop - start time.sleep(60-diff) if __name__ == '__main__': main()