Update GeoRide trademark wording

develop
Matthieu DUVAL 4 years ago
parent 1275ffa882
commit 93f089c431

@ -1,5 +1,5 @@
# Georideapilib
![Logo Georide](georide-logo.png)
# georideapilib
![Logo GeoRide](georide-logo.png)
⚠️ this is not an official implementation

@ -5,9 +5,9 @@ import time
import datetime
logging.config.fileConfig('logging.conf')
from georideapilib.objects import GeorideAccount
import georideapilib.api as GeorideApi
from georideapilib.socket import GeorideSocket
from georideapilib.objects import GeoRideAccount
import georideapilib.api as GeoRideApi
from georideapilib.socket import GeoRideSocket
from threading import Thread
@ -20,17 +20,17 @@ def example():
# account = GeorideAccount(0, "<your_email>", False, token)
account = GeorideApi.get_authorisation_token("<your_email>", "<your_password>")
account = GeoRideApi.get_authorisation_token("<your_email>", "<your_password>")
print("token 1: ", account.auth_token)
_LOGGER.info("token 1: %s", account.auth_token)
# pylint: disable=W0105
def locked_locked(data):
_LOGGER.info("Locke received")
_LOGGER.info("Lock received")
def connect_socket(account):
socket = GeorideSocket()
socket = GeoRideSocket()
socket.subscribe_locked(locked_locked)
socket.init()
socket.connect(account.auth_token)
@ -45,44 +45,44 @@ def example():
print("token 2: ", account.auth_token)
""" # pylint: disable=W0105
user = GeorideApi.get_user(account.auth_token)
user = GeoRideApi.get_user(account.auth_token)
_LOGGER.info("User: %s", user.first_name)
trackers = GeorideApi.get_trackers(account.auth_token)
trackers = GeoRideApi.get_trackers(account.auth_token)
tracker = trackers[0]
_LOGGER.info("Tracker name: %s", tracker.tracker_name)
trips = GeorideApi.get_trips(account.auth_token, tracker.tracker_id, "2019-10-10", "2019-10-24")
trips = GeoRideApi.get_trips(account.auth_token, tracker.tracker_id, "2019-10-10", "2019-10-24")
trip = trips[0]
trip_date = datetime.datetime.strptime("2019-10-10T06:45:34.000Z", '%Y-%m-%dT%H:%M:%S.%fZ')
_LOGGER.info("Trip date: %s, from: %s, to: %s", trip_date, trip.nice_start_address,
trip.nice_end_address)
positions = GeorideApi.get_positions(account.auth_token, tracker.tracker_id,
positions = GeoRideApi.get_positions(account.auth_token, tracker.tracker_id,
"2019-10-10", "2019-10-24")
position = positions[0]
_LOGGER.info("Position speed: %s, lon: %s, lat: %s", position.speed, position.longitude,
position.latitude)
trip_shared = GeorideApi.share_a_trip_by_date(account.auth_token, tracker.tracker_id,
trip_shared = GeoRideApi.share_a_trip_by_date(account.auth_token, tracker.tracker_id,
"2019-10-10", "2019-10-24")
_LOGGER.info("tripShared url: %s, id: %s", trip_shared.url, trip_shared.share_id)
time.sleep(10)
have_been_locked = GeorideApi.lock_tracker(account.auth_token, tracker.tracker_id)
have_been_locked = GeoRideApi.lock_tracker(account.auth_token, tracker.tracker_id)
_LOGGER.info("Tracker have been locked: %s", have_been_locked)
time.sleep(10)
have_been_unlocked = GeorideApi.unlock_tracker(account.auth_token, tracker.tracker_id)
have_been_unlocked = GeoRideApi.unlock_tracker(account.auth_token, tracker.tracker_id)
_LOGGER.info("Tracker have been unlocked: %s", have_been_unlocked)
time.sleep(10)
is_locked = GeorideApi.toogle_lock_tracker(account.auth_token, tracker.tracker_id)
is_locked = GeoRideApi.toogle_lock_tracker(account.auth_token, tracker.tracker_id)
_LOGGER.info("Tracker is locked: %s", is_locked)
time.sleep(10)
trackers = GeorideApi.get_trackers(account.auth_token)
trackers = GeoRideApi.get_trackers(account.auth_token)
tracker = trackers[0]
_LOGGER.info("Tracker name: %s is locked: %s", tracker.tracker_name, tracker.is_locked)

@ -8,12 +8,12 @@ import logging
import requests
from georideapilib.objects import (
GeorideTracker,
GeorideAccount,
GeorideUser,
GeorideTrackerTrip,
GeorideTrackerPosition,
GeorideSharedTrip
GeoRideTracker,
GeoRideAccount,
GeoRideUser,
GeoRideTrackerTrip,
GeoRideTrackerPosition,
GeoRideSharedTrip
)
from georideapilib.exception import (
@ -51,7 +51,7 @@ def get_authorisation_token(email, password):
if response.status_code == 200:
_LOGGER.debug("Login success")
response_data = response.json()
account = GeorideAccount.from_json(response_data)
account = GeoRideAccount.from_json(response_data)
elif response.status_code == 403:
_LOGGER.warning("Login failed")
raise LoginException(get_authorisation_token, "Login failed")
@ -104,7 +104,7 @@ def get_user(token):
headers=headers)
response_data = response.json()
_LOGGER.debug(response_data)
account = GeorideUser.from_json(response_data)
account = GeoRideUser.from_json(response_data)
return account
def get_trackers(token):
@ -117,7 +117,7 @@ def get_trackers(token):
response_data = response.json()
trackers = []
for json_tracker in response_data:
trackers.append(GeorideTracker.from_json(json_tracker))
trackers.append(GeoRideTracker.from_json(json_tracker))
return trackers
@ -132,7 +132,7 @@ def get_trips(token, tracker_id, from_date, to_date):
response_data = response.json()
trips = []
for json_trip in response_data:
trips.append(GeorideTrackerTrip.from_json(json_trip))
trips.append(GeoRideTrackerTrip.from_json(json_trip))
return trips
def get_positions(token, tracker_id, from_date, to_date):
@ -146,7 +146,7 @@ def get_positions(token, tracker_id, from_date, to_date):
response_data = response.json()
positions = []
for json_position in response_data:
positions.append(GeorideTrackerPosition.from_json(json_position))
positions.append(GeoRideTrackerPosition.from_json(json_position))
return positions
def share_a_trip_by_trip_id(token, tracker_id, trip_id):
@ -184,7 +184,7 @@ def _share_a_trip(token, tracker_id, trip_id=None, from_date=None, # pylint: dis
headers=headers)
response_data = response.json()
return GeorideSharedTrip.from_json(response_data)
return GeoRideSharedTrip.from_json(response_data)
def lock_tracker(token, tracker_id):
""" used to lock a tracker """

@ -1,4 +1,4 @@
""" all geroide exception """
""" all GeoRide exception """
class Error(Exception):
"""Base class for exceptions in this module."""

@ -3,7 +3,12 @@ Georide objects implementation
@author Matthieu DUVAL <matthieu@duval-dev.fr>
"""
class GeorideSharedTrip:
import logging
_LOGGER = logging.getLogger(__name__)
class GeoRideSharedTrip:
""" Shared trip object representation """
def __init__(self, url, shareId):
self._url = url
@ -22,12 +27,12 @@ class GeorideSharedTrip:
@staticmethod
def from_json(json):
"""return new object fromjson"""
return GeorideSharedTrip(
return GeoRideSharedTrip(
json['url'],
json['shareId']
)
class GeorideTrackerTrip: # pylint: disable=too-many-instance-attributes
class GeoRideTrackerTrip: # pylint: disable=too-many-instance-attributes
""" Trip object representation """
def __init__(self, trip_id, tracker_id, average_speed, max_speed, distance, duration, # pylint: disable=R0914, R0913
start_address, nice_start_address, start_lat, start_lon, end_address,
@ -134,7 +139,7 @@ class GeorideTrackerTrip: # pylint: disable=too-many-instance-attributes
@staticmethod
def from_json(json):
"""return new object from json"""
return GeorideTrackerTrip(
return GeoRideTrackerTrip(
json['id'],
json['trackerId'],
json['averageSpeed'],
@ -153,8 +158,7 @@ class GeorideTrackerTrip: # pylint: disable=too-many-instance-attributes
json['endTime']
)
class GeorideTrackerPosition:
class GeoRideTrackerPosition:
""" Tracker position object representation """
def __init__(self, fixtime, latitude, longitude, altitude, speed, address): # pylint: disable= R0913
self._fixtime = fixtime
@ -197,7 +201,7 @@ class GeorideTrackerPosition:
@staticmethod
def from_json(json):
"""return new object fromjson"""
return GeorideTrackerPosition(
return GeoRideTrackerPosition(
json['fixtime'],
json['latitude'],
json['longitude'],
@ -206,10 +210,7 @@ class GeorideTrackerPosition:
json['address']
)
class GeorideTracker: # pylint: disable=R0904,R0902
class GeoRideTracker: # pylint: disable=R0904,R0902
""" Tracker position object representation """
def __init__(self, tracker_id, tracker_name, device_button_action, device_button_delay, # pylint: disable= R0913, R0914, R0915
vibration_level, is_old_tracker, auto_lock_freezed_to, fixtime, role,
@ -490,7 +491,7 @@ class GeorideTracker: # pylint: disable=R0904,R0902
@staticmethod
def from_json(json):
"""return new object fromjson"""
return GeorideTracker(
return GeoRideTracker(
json['trackerId'],
json['trackerName'],
json['deviceButtonAction'],
@ -530,8 +531,7 @@ class GeorideTracker: # pylint: disable=R0904,R0902
json['status']
)
class GeorideAccount:
class GeoRideAccount:
""" Account object representation """
def __init__(self, account_id, email, is_admin, auth_token):
self._account_id = account_id
@ -567,7 +567,7 @@ class GeorideAccount:
@staticmethod
def from_json(json):
"""return new object from_json"""
return GeorideAccount(
return GeoRideAccount(
json['id'],
json['email'],
json['isAdmin'],
@ -575,7 +575,8 @@ class GeorideAccount:
)
class GeorideUser: # pylint: disable= R0902
class GeoRideUser: # pylint: disable= R0902
""" User object representation """
def __init__(self, user_id, email, first_name, created_at, phone_number, # pylint: disable= R0913
push_user_token, legal, date_of_birth):
@ -631,7 +632,7 @@ class GeorideUser: # pylint: disable= R0902
@staticmethod
def from_json(json):
"""return new object fromjson"""
return GeorideUser(
return GeoRideUser(
json['id'],
json['email'],
json['firstName'],
@ -641,3 +642,95 @@ class GeorideUser: # pylint: disable= R0902
json['legal'],
json['dateOfBirth']
)
#TODO: remove in v0.8.0
class GeorideSharedTrip(GeoRideSharedTrip):
""" Shared trip object representation """
def __init_subclass__(cls, **kwargs):
"""Print deprecation warning."""
super().__init_subclass__(**kwargs)
_LOGGER.warning(
"GeorideSharedTrip is deprecated, modify %s to use GeoRideSharedTrip",
cls.__name__,
)
def __init__(self, *argv):
"""Print deprecation warning."""
super().__init__(*argv)
_LOGGER.warning("GeorideSharedTrip is deprecated, modify your code to use GeoRideSharedTrip")
class GeorideTrackerTrip(GeoRideTrackerTrip):
""" Trip object representation """
def __init_subclass__(cls, **kwargs):
"""Print deprecation warning."""
super().__init_subclass__(**kwargs)
_LOGGER.warning(
"GeorideTrackerTrip is deprecated, modify %s to use GeoRideTrackerTrip",
cls.__name__,
)
def __init__(self, *argv):
"""Print deprecation warning."""
super().__init__(*argv)
_LOGGER.warning("GeorideTrackerTrip is deprecated, modify your code to use GeoRideTrackerTrip")
class GeorideTrackerPosition(GeoRideTrackerPosition):
""" Trip object representation """
def __init_subclass__(cls, **kwargs):
"""Print deprecation warning."""
super().__init_subclass__(**kwargs)
_LOGGER.warning(
"GeorideTrackerPosition is deprecated, modify %s to use GeoRideTrackerPosition",
cls.__name__,
)
def __init__(self, *argv):
"""Print deprecation warning."""
super().__init__(*argv)
_LOGGER.warning("GeorideTrackerPosition is deprecated, modify your code to use GeoRideTrackerPosition")
class GeorideTracker(GeoRideTracker):
""" Trip object representation """
def __init_subclass__(cls, **kwargs):
"""Print deprecation warning."""
super().__init_subclass__(**kwargs)
_LOGGER.warning(
"GeorideTracker is deprecated, modify %s to use GeoRideTracker",
cls.__name__,
)
def __init__(self, *argv):
"""Print deprecation warning."""
super().__init__(*argv)
_LOGGER.warning("GeorideTracker is deprecated, modify your code to use GeoRideTracker")
class GeorideAccount(GeoRideAccount):
""" Trip object representation """
def __init_subclass__(cls, **kwargs):
"""Print deprecation warning."""
super().__init_subclass__(**kwargs)
_LOGGER.warning(
"GeorideAccount is deprecated, modify %s to use GeoRideAccount",
cls.__name__,
)
def __init__(self, *argv):
"""Print deprecation warning."""
super().__init__(*argv)
_LOGGER.warning("GeorideAccount is deprecated, modify your code to use GeoRideAccount")
class GeorideUser(GeoRideUser):
""" Trip object representation """
def __init_subclass__(cls, **kwargs):
"""Print deprecation warning."""
super().__init_subclass__(**kwargs)
_LOGGER.warning(
"GeorideUser is deprecated, modify %s to use GeoRideUser",
cls.__name__,
)
def __init__(self, *argv):
"""Print deprecation warning."""
super().__init__(*argv)
_LOGGER.warning("GeorideUser is deprecated, modify your code to use GeoRideUser")

@ -1,4 +1,4 @@
""" Georide socket-io implementation """
""" GeoRide socket-io implementation """
import logging
import socketio
@ -19,8 +19,8 @@ def on_disconnect():
_LOGGER.debug('GeoRide socket disconnected')
class GeorideSocket():
"""docstring for GeorideSocket"""
class GeoRideSocket():
"""docstring for GeoRideSocket"""
def __init__(self):
self._on_message_callback = None
self._on_device_callback = None
@ -112,3 +112,19 @@ class GeorideSocket():
def disconnect(self):
"""disconnect from the georide socket"""
sio.disconnect()
#TODO: remove in v0.8.0
class GeorideSocket(GeoRideSocket):
""" Trip object representation """
def __init_subclass__(cls, **kwargs):
"""Print deprecation warning."""
super().__init_subclass__(**kwargs)
_LOGGER.warning(
"GeorideSocket is deprecated, modify %s to use GeoRideSocket",
cls.__name__,
)
def __init__(self, *argv):
"""Print deprecation warning."""
super().__init__(*argv)
_LOGGER.warning("GeorideSocket is deprecated, modify your code to use GeoRideSocket")

@ -17,6 +17,12 @@ handlers=consoleHandler
qualname=simpleExample
propagate=0
[logger_engine_io]
level=ERROR
handlers=consoleHandler
qualname=engineio.client
propagate=0
[handler_consoleHandler]
class=StreamHandler

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

Loading…
Cancel
Save