3 Commits

Author SHA1 Message Date
d93bab0fcf Imporve example 2022-03-06 12:25:50 +01:00
e29e530d42 Fix tracher beacon reponse set to an array unsed of a unique object 2022-03-04 18:35:44 +01:00
841740ec4c Fix miss import GeoRideTrackerBeacon 2022-03-04 16:07:02 +01:00
3 changed files with 14 additions and 8 deletions

View File

@@ -28,10 +28,13 @@ def example():
def locked_locked(data):
_LOGGER.info("Lock received")
def refresh_tracker():
_LOGGER.info("Refresh tracker recieved")
def connect_socket(account):
socket = GeoRideSocket()
socket.subscribe_locked(locked_locked)
socket.subscribe_refresh_tracker(refresh_tracker)
socket.init()
socket.connect(account.auth_token)
time.sleep(10)

View File

@@ -13,7 +13,8 @@ from georideapilib.objects import (
GeoRideUser,
GeoRideTrackerTrip,
GeoRideTrackerPosition,
GeoRideSharedTrip
GeoRideSharedTrip,
GeoRideTrackerBeacon
)
from georideapilib.exception import (
@@ -128,7 +129,7 @@ def get_trackers(token):
trackers.append(GeoRideTracker.from_json(json_tracker))
return trackers
def get_tracker_beacon(token, tracker_id):
def get_tracker_beacons(token, tracker_id):
""" get user trackers """
headers = {"Authorization": "Bearer " + token}
@@ -137,11 +138,13 @@ def get_tracker_beacon(token, tracker_id):
headers=headers)
response_data = response.json()
trackers_beacons = []
if response.status_code == 200:
response_data['linked_tracker_id'] = tracker_id
return GeoRideTrackerBeacon.from_json(response_data)
else:
return None
for json_tracker_beacon in response_data:
_LOGGER.debug(json_tracker_beacon)
json_tracker_beacon['linked_tracker_id'] = tracker_id
trackers_beacons.append(GeoRideTrackerBeacon.from_json(json_tracker_beacon))
return trackers_beacons
def get_trips(token, tracker_id, from_date, to_date):
""" return all trips between two dates """

View File

@@ -19,13 +19,13 @@ CURRENT_DIR = os.path.dirname(__file__)
setup(
name='georideapilib',
packages=['georideapilib'], # this must be the same as the name above
version='0.8.0',
version='0.8.2',
description='Lib to control GeoRide tracker devices with theire rest api',
author='Matthieu DUVAL',
author_email='georideapilib@duval-dev.fr',
# use the URL to the github repo
url='https://github.com/hacf/georide-api',
download_url='https://codeload.github.com/hacf/georide-api/tar.gz/0.8.0',
download_url='https://codeload.github.com/hacf/georide-api/tar.gz/0.8.1',
keywords=['rest', 'georide', 'api', 'grutier', 'GeoRide'], # arbitrary keywords
classifiers=[],
install_requires=["python-socketio[client]==4.6.1"],