8 Commits

Author SHA1 Message Date
b6ede1af3b Shipping 0.6.1 2021-05-05 22:43:49 +02:00
e38a402d44 Shipping v0.6.0 2021-04-11 17:41:10 +02:00
e59cd77908 Shipping v0.4.4 2019-11-03 20:26:49 +01:00
6ab8749f11 Shipping v0.4.3 2019-11-02 17:51:48 +01:00
13df6822c8 Shipping v0.4.2 2019-11-02 17:42:36 +01:00
b78c503b31 Shipping v0.4.1 2019-10-30 20:35:02 +01:00
e69b2dfab9 Shipping v0.4.0 2019-10-29 22:46:15 +01:00
f168ad9e47 Shipping v0.3.0 2019-10-29 21:58:12 +01:00
7 changed files with 152 additions and 518 deletions

3
.gitignore vendored
View File

@@ -3,5 +3,4 @@ __pycache__
**/__pycache__ **/__pycache__
dist/ dist/
*.egg-info/ *.egg-info/
build/ build/
ressources/

View File

@@ -27,7 +27,7 @@ This library has been tested with python 3.7 and above, functionality for older
## Main repo: ## Main repo:
- https://git.tontontux.fr/mduval/pyGeoride - https://git.tontontux.fr/mduval/pyGeoride
## Github repo: ## Github repo:
- https://github.com/ptimatth/georide-api - https://github.com/ptimatth/pyGeoride
## Todo ## Todo
- [ ] Add support of "Get a shared trip" endpoint - [ ] Add support of "Get a shared trip" endpoint

View File

@@ -86,32 +86,7 @@ def example():
tracker = trackers[0] tracker = trackers[0]
_LOGGER.info("Tracker name: %s is locked: %s", tracker.tracker_name, tracker.is_locked) _LOGGER.info("Tracker name: %s is locked: %s", tracker.tracker_name, tracker.is_locked)
if tracker.version >= 3:
_LOGGER.info("Congrat for your new gen GeoRide \o/")
# Have been commented for your neighbor ;)
# time.sleep(10)
# have_been_siren_turned_on = GeoRideApi.change_tracker_siren_state(account.auth_token, tracker.tracker_id, True)
# _LOGGER.info("Tracker siren is on: %s", have_been_siren_turned_on)
# time.sleep(5)
# have_been_siren_turned_off = GeoRideApi.change_tracker_siren_state(account.auth_token, tracker.tracker_id, False)
# _LOGGER.info("Tracker siren is off: %s", have_been_siren_turned_off)
time.sleep(10)
changed_to_eco_mode = GeoRideApi.change_tracker_eco_mode_state(account.auth_token, tracker.tracker_id, True)
_LOGGER.info("Tracker eco mode is on: %s", changed_to_eco_mode)
time.sleep(5)
changed_to_normal_mode = GeoRideApi.change_tracker_eco_mode_state(account.auth_token, tracker.tracker_id, False)
_LOGGER.info("Tracker eco mode is off: %s", changed_to_normal_mode)
tracker_beacon = GeoRideApi.get_tracker_beacon(account.auth_token, tracker.tracker_id)
_LOGGER.info("Your tracker beacon state: %s", tracker_beacon)
#you can also shutdown your tracker with shutdown_tracker(<token>, tracker_id) but i d'on give you an example.
else:
_LOGGER.info("You are from the first wave ;)")
""" """

View File

@@ -13,8 +13,7 @@ from georideapilib.objects import (
GeoRideUser, GeoRideUser,
GeoRideTrackerTrip, GeoRideTrackerTrip,
GeoRideTrackerPosition, GeoRideTrackerPosition,
GeoRideSharedTrip, GeoRideSharedTrip
GeoRideTrackerBeacon
) )
from georideapilib.exception import ( from georideapilib.exception import (
@@ -28,19 +27,13 @@ GEORIDE_API_ENDPOINT_LOGIN = "/user/login"
GEORIDE_API_ENDPOINT_NEW_TOKEN = "/user/new-token" GEORIDE_API_ENDPOINT_NEW_TOKEN = "/user/new-token"
GEORIDE_API_ENDPOINT_LOGOUT = "/user/logout" GEORIDE_API_ENDPOINT_LOGOUT = "/user/logout"
GEORIDE_API_ENDPOINT_USER = "/user" GEORIDE_API_ENDPOINT_USER = "/user"
GEORIDE_API_ENDPOINT_TRACKERS = "/user/trackers" GEORIDE_API_ENDPOINT_TRAKERS = "/user/trackers"
GEORIDE_API_ENDPOINT_TRIPS = "/tracker/:trackerId/trips" GEORIDE_API_ENDPOINT_TRIPS = "/tracker/:trackerId/trips"
GEORIDE_API_ENDPOINT_LOCK = "/tracker/:trackerId/lock" GEORIDE_API_ENDPOINT_LOCK = "/tracker/:trackerId/lock"
GEORIDE_API_ENDPOINT_TRACKER_BEACON = "/tracker/:trackerId/beacon"
GEORIDE_API_ENDPOINT_UNLOCK = "/tracker/:trackerId/unlock" GEORIDE_API_ENDPOINT_UNLOCK = "/tracker/:trackerId/unlock"
GEORIDE_API_ENDPOINT_TOGGLE_LOCK = "/tracker/:trackerId/toggleLock" GEORIDE_API_ENDPOINT_TOGGLE_LOCK = "/tracker/:trackerId/toggleLock"
GEORIDE_API_ENDPOINT_POSITIONS = "/tracker/:trackerId/trips/positions" GEORIDE_API_ENDPOINT_POSITIONS = "/tracker/:trackerId/trips/positions"
GEORIDE_API_ENDPOINT_TRIP_SHARE = "/tracker/:trackerId/share/trip" GEORIDE_API_ENDPOINT_TRIP_SHARE = "/tracker/:trackerId/share/trip"
GEORIDE_API_ENDPOINT_SHUTDOWN_TRACKER = "/tracker/:trackerId/shutdown"
GEORIDE_API_ENDPOINT_TRACKER_ALARM_OFF = "/tracker/:trackerId/sonor-alarm/off"
GEORIDE_API_ENDPOINT_TRACKER_ALARM_ON = "/tracker/:trackerId/sonor-alarm/on"
GEORIDE_API_ENDPOINT_TRACKER_ECO_MODE_OFF = "/tracker/:trackerId/eco-mode/off"
GEORIDE_API_ENDPOINT_TRACKER_ECO_MODE_ON = "/tracker/:trackerId/eco-mode/on"
_SESSION = requests.Session() _SESSION = requests.Session()
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
@@ -119,7 +112,7 @@ def get_trackers(token):
headers = {"Authorization": "Bearer " + token} headers = {"Authorization": "Bearer " + token}
response = _SESSION.get( response = _SESSION.get(
GEORIDE_API_HOST + GEORIDE_API_ENDPOINT_TRACKERS, GEORIDE_API_HOST + GEORIDE_API_ENDPOINT_TRAKERS,
headers=headers) headers=headers)
response_data = response.json() response_data = response.json()
@@ -129,20 +122,6 @@ def get_trackers(token):
trackers.append(GeoRideTracker.from_json(json_tracker)) trackers.append(GeoRideTracker.from_json(json_tracker))
return trackers return trackers
def get_tracker_beacon(token, tracker_id):
""" get user trackers """
headers = {"Authorization": "Bearer " + token}
response = _SESSION.get(
GEORIDE_API_HOST + GEORIDE_API_ENDPOINT_TRACKER_BEACON.replace(':trackerId', str(tracker_id)),
headers=headers)
response_data = response.json()
if response.status_code == 200:
response_data['linked_tracker_id'] = tracker_id
return GeoRideTrackerBeacon.from_json(response_data)
else:
return None
def get_trips(token, tracker_id, from_date, to_date): def get_trips(token, tracker_id, from_date, to_date):
""" return all trips between two dates """ """ return all trips between two dates """
@@ -238,46 +217,5 @@ def toogle_lock_tracker(token, tracker_id):
response_data = response.json() response_data = response.json()
return response_data['locked'] return response_data['locked']
def change_tracker_siren_state(token, tracker_id, state: bool):
""" used to toggle lock a tracker """
headers = {"Authorization": "Bearer " + token}
response = None
if state == True:
response = _SESSION.post(
GEORIDE_API_HOST + GEORIDE_API_ENDPOINT_TRACKER_ALARM_ON.replace(':trackerId', str(tracker_id)),
headers=headers)
else:
response = _SESSION.post(
GEORIDE_API_HOST + GEORIDE_API_ENDPOINT_TRACKER_ALARM_OFF.replace(':trackerId', str(tracker_id)),
headers=headers)
if response.status_code != 204:
return False
return True
def change_tracker_eco_mode_state(token, tracker_id, state: bool):
""" used to toggle lock a tracker """
headers = {"Authorization": "Bearer " + token}
response = None
if state == True:
response = _SESSION.post(
GEORIDE_API_HOST + GEORIDE_API_ENDPOINT_TRACKER_ECO_MODE_ON.replace(':trackerId', str(tracker_id)),
headers=headers)
else:
response = _SESSION.post(
GEORIDE_API_HOST + GEORIDE_API_ENDPOINT_TRACKER_ECO_MODE_OFF.replace(':trackerId', str(tracker_id)),
headers=headers)
if response.status_code != 204:
return False
return True
def shutdown_tracker(token, tracker_id):
""" used to toggle lock a tracker """
headers = {"Authorization": "Bearer " + token}
response = _SESSION.post(
GEORIDE_API_HOST + GEORIDE_API_ENDPOINT_SHUTDOWN_TRACKER.replace(':trackerId', str(tracker_id)),
headers=headers)
response_data = response.json()
return response_data['locked']
if __name__ == '__main__': if __name__ == '__main__':
print("Not a main module") print("Not a main module")

View File

@@ -2,19 +2,12 @@
Georide objects implementation Georide objects implementation
@author Matthieu DUVAL <matthieu@duval-dev.fr> @author Matthieu DUVAL <matthieu@duval-dev.fr>
""" """
import time
import logging import logging
_LOGGER = logging.getLogger(__name__) _LOGGER = logging.getLogger(__name__)
class JsonMgtMetaClass(type):
@staticmethod
def json_field_protect(json, field_name, default_value = None):
return json[field_name] if field_name in json.keys() else default_value
class GeoRideSharedTrip: class GeoRideSharedTrip:
""" Shared trip object representation """ """ Shared trip object representation """
def __init__(self, url, shareId): def __init__(self, url, shareId):
@@ -217,7 +210,7 @@ class GeoRideTrackerPosition:
json['address'] json['address']
) )
class GeoRideTracker(metaclass=JsonMgtMetaClass): # pylint: disable=R0904,R0902 class GeoRideTracker: # pylint: disable=R0904,R0902
""" Tracker position object representation """ """ Tracker position object representation """
def __init__(self, tracker_id, tracker_name, device_button_action, device_button_delay, # pylint: disable= R0913, R0914, R0915 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, vibration_level, is_old_tracker, auto_lock_freezed_to, fixtime, role,
@@ -227,10 +220,7 @@ class GeoRideTracker(metaclass=JsonMgtMetaClass): # pylint: disable=R0904,R0902
is_locked, can_see_position, can_lock, can_unlock, can_share, can_unshare, is_locked, can_see_position, can_lock, can_unlock, can_share, can_unshare,
can_check_speed, can_see_statistics, can_send_broken_down_signal, can_check_speed, can_see_statistics, can_send_broken_down_signal,
can_send_stolen_signal, status, subscription_id, external_battery_voltage, can_send_stolen_signal, status, subscription_id, external_battery_voltage,
internal_battery_voltage, timezone, is_second_gen, is_up_to_date, internal_battery_voltage, timezone, is_second_gen, is_up_to_date):
subscription, version, gift_card_expires, gift_card_months, odometer_updated_at,
maintenance_mode_until, battery_updated_at, is_in_eco, is_calibrated,
is_oldsubscription, software_version, has_beacon, has_outdated_beacons, ecall_activated):
self._tracker_id = tracker_id self._tracker_id = tracker_id
self._tracker_name = tracker_name self._tracker_name = tracker_name
self._device_button_action = device_button_action self._device_button_action = device_button_action
@@ -274,23 +264,6 @@ class GeoRideTracker(metaclass=JsonMgtMetaClass): # pylint: disable=R0904,R0902
self._timezone = timezone self._timezone = timezone
self._is_second_gen = is_second_gen self._is_second_gen = is_second_gen
self._is_up_to_date = is_up_to_date self._is_up_to_date = is_up_to_date
self._subscription = subscription
self._version = version
self._gift_card_expires = gift_card_expires
self._gift_card_months = gift_card_months
self._odometer_updated_at = odometer_updated_at
self._maintenance_mode_until = maintenance_mode_until
self._battery_updated_at = battery_updated_at
self._is_in_eco = is_in_eco
self._is_calibrated = is_calibrated
self._is_oldsubscription = is_oldsubscription
self._software_version = software_version
self._has_beacon = has_beacon
self._has_outdated_beacons = has_outdated_beacons
self._ecall_activated = ecall_activated
self._is_siren_on = False
self._siren_last_on_date = time.time()
@property @property
def tracker_id(self): def tracker_id(self):
""" tracker_id """ """ tracker_id """
@@ -561,159 +534,54 @@ class GeoRideTracker(metaclass=JsonMgtMetaClass): # pylint: disable=R0904,R0902
"""is_up_to_date property""" """is_up_to_date property"""
return self._is_up_to_date return self._is_up_to_date
@property
def subscription(self):
""" subscription property """
return self._subscription
@property @staticmethod
def version(self): def from_json(json):
""" version property """
return self._version
@property
def gift_card_expires(self):
""" gift_card_expires property """
return self._gift_card_expires
@property
def gift_card_months(self):
""" gift_card_months property """
return self._gift_card_months
@property
def odometer_updated_at(self):
""" odometer_updated_at property """
return self._odometer_updated_at
@property
def maintenance_mode_until(self):
""" maintenance_mode_until property """
return self._maintenance_mode_until
@property
def battery_updated_at(self):
""" battery_updated_at property """
return self._battery_updated_at
@property
def is_in_eco(self):
""" is_in_eco property """
return self._is_in_eco
@is_in_eco.setter
def is_in_eco(self, is_in_eco):
""" is_in_eco setter """
self._is_in_eco = is_in_eco
@property
def is_siren_on(self):
""" is_siren_on property """
return self._is_siren_on
@is_siren_on.setter
def is_siren_on(self, is_siren_on):
""" is_siren_on setter """
if is_siren_on:
self._siren_last_on_date = time.time()
self._is_siren_on = is_siren_on
@property
def siren_last_on_date(self):
""" siren_last_on_date property """
return self._siren_last_on_date
@property
def is_calibrated(self):
""" is_calibrated property """
return self._is_calibrated
@property
def is_oldsubscription(self):
""" is_oldsubscription property """
return self._is_oldsubscription
@property
def software_version(self):
""" software_version property """
return self._software_version
@property
def has_beacon(self):
""" has_beacon property """
return self._has_beacon
@property
def has_outdated_beacons(self):
""" has_outdated_beacons property """
return self._has_outdated_beacons
@property
def ecall_activated(self):
""" ecall_activated property """
return self._ecall_activated
@classmethod
def from_json(cls, json):
"""return new object fromjson""" """return new object fromjson"""
return GeoRideTracker( return GeoRideTracker(
json['trackerId'], # Mandatory json['trackerId'],
json['trackerName'], # Mandatory json['trackerName'],
cls.json_field_protect(json,'deviceButtonAction'), json['deviceButtonAction'],
cls.json_field_protect(json,'deviceButtonDelay'), json['deviceButtonDelay'],
cls.json_field_protect(json,'vibrationLevel'), json['vibrationLevel'],
cls.json_field_protect(json,'isOldTracker', False), json['isOldTracker'],
cls.json_field_protect(json,'autoLockFreezedTo'), json['autoLockFreezedTo'],
cls.json_field_protect(json,'fixtime'), json['fixtime'],
json['role'], # Mandatory json['role'],
json['lastPaymentDate'],# Mandatory json['lastPaymentDate'],
cls.json_field_protect(json,'giftCardId'), json['giftCardId'],
cls.json_field_protect(json,'expires'), json['expires'],
cls.json_field_protect(json,'activationDate'), json['activationDate'],
json['odometer'],#Mandatory json['odometer'],
cls.json_field_protect(json,'isStolen', False), json['isStolen'],
cls.json_field_protect(json,'isCrashed', False), json['isCrashed'],
cls.json_field_protect(json,'crashDetectionDisabled'), json['crashDetectionDisabled'],
json['speed'], # Mandatory json['speed'],
json['moving'], # Mandatory json['moving'],
cls.json_field_protect(json,'positionId', -1), json['positionId'],
json['latitude'], # Mandatory json['latitude'],
json['longitude'], # Mandatory json['longitude'],
cls.json_field_protect(json,'altitude', 0), json['altitude'],
cls.json_field_protect(json,'lockedPositionId'), json['lockedPositionId'],
cls.json_field_protect(json,'lockedLatitude'), json['lockedLatitude'],
cls.json_field_protect(json,'lockedLongitude'), json['lockedLongitude'],
json['isLocked'], # Mandatory json['isLocked'],
json['canSeePosition'],# Mandatory json['canSeePosition'],
cls.json_field_protect(json,'canLock', False), json['canLock'],
cls.json_field_protect(json,'canUnlock', False), json['canUnlock'],
cls.json_field_protect(json,'canShare', False), json['canShare'],
cls.json_field_protect(json,'canUnshare', False), json['canUnshare'],
cls.json_field_protect(json,'canCheckSpeed', False), json['canCheckSpeed'],
cls.json_field_protect(json,'canSeeStatistics', False), json['canSeeStatistics'],
cls.json_field_protect(json,'canSendBrokenDownSignal', False), json['canSendBrokenDownSignal'],
cls.json_field_protect(json,'canSendStolenSignal', False), json['canSendStolenSignal'],
json['status'],# Mandatory json['status'],
cls.json_field_protect(json,'subscriptionId'), None if json['subscriptionId'] == "None" else json['subscriptionId'],
cls.json_field_protect(json,'externalBatteryVoltage', -1.0), None if json['externalBatteryVoltage'] == "None" else json['externalBatteryVoltage'],
cls.json_field_protect(json,'internalBatteryVoltage', -1.0), None if json['internalBatteryVoltage'] == "None" else json['internalBatteryVoltage'],
cls.json_field_protect(json,'timezone', "Europe/Paris"), json['timezone'],
cls.json_field_protect(json,'isSecondGen', False), json['isSecondGen'],
cls.json_field_protect(json,'isUpToDate', False), json['isUpToDate']
GeoRideSubscription.from_json(json['subscription']) if cls.json_field_protect(json,'subscription') is not None else None,
cls.json_field_protect(json,'version', -1),
cls.json_field_protect(json,'giftCardExpires'),
cls.json_field_protect(json,'giftCardMonths'),
cls.json_field_protect(json,'odometerUpdatedAt'),
cls.json_field_protect(json,'maintenanceModeUntil'),
cls.json_field_protect(json,'batteryUpdatedAt'),
cls.json_field_protect(json,'isInEco', False),
cls.json_field_protect(json,'isCalibrated', True),
cls.json_field_protect(json,'isOldSubscription', True),
cls.json_field_protect(json,'softwareVersion', -1),
cls.json_field_protect(json,'hasBeacon', False),
cls.json_field_protect(json,'hasOutdatedBeacons', False),
cls.json_field_protect(json,'eCallActivated', False)
) )
def update_all_data(self, tracker): def update_all_data(self, tracker):
@@ -760,247 +628,6 @@ class GeoRideTracker(metaclass=JsonMgtMetaClass): # pylint: disable=R0904,R0902
self._timezone = tracker.timezone self._timezone = tracker.timezone
self._is_second_gen = tracker.is_second_gen self._is_second_gen = tracker.is_second_gen
self._is_up_to_date = tracker.is_up_to_date self._is_up_to_date = tracker.is_up_to_date
self._subscription = tracker.subscription
self._version = tracker.version
self._gift_card_expires = tracker.gift_card_expires
self._gift_card_months = tracker.gift_card_months
self._odometer_updated_at = tracker.odometer_updated_at
self._maintenance_mode_until = tracker.maintenance_mode_until
self._battery_updated_at = tracker.battery_updated_at
self._is_in_eco = tracker.is_in_eco
self._is_calibrated = tracker.is_calibrated
self._is_oldsubscription = tracker.is_oldsubscription
self._software_version = tracker.software_version
self._has_beacon = tracker.has_beacon
self._has_outdated_beacons = tracker.has_outdated_beacons
self._ecall_activated = tracker.ecall_activated
class GeoRideTrackerBeacon:
""" GeoRideTrackerBeacon representation """
def __init__(self, beacon_id, linked_tracker_id, name, created_at, updated_at,
mac_address, battery_level, last_battery_level_update, sleep_delay,
is_updated, power):
self._beacon_id = beacon_id
self._linked_tracker_id = linked_tracker_id
self._name = name
self._created_at = created_at
self._updated_at = updated_at
self._mac_address = mac_address
self._battery_level = battery_level
self._last_battery_level_update = last_battery_level_update
self._sleep_delay = sleep_delay
self._is_updated = is_updated
self._power = power
@property
def linked_tracker_id(self):
""" linked_tracker_id property """
return self._linked_tracker_id
@linked_tracker_id.setter
def linked_tracker_id(self, linked_tracker_id):
""" linked_tracker_id setter """
self._linked_tracker_id = linked_tracker_id
@property
def beacon_id(self):
"""beacon_id property"""
return self._beacon_id
@property
def name(self):
"""name property"""
return self._name
@property
def created_at(self):
"""created_at property"""
return self._created_at
@property
def updated_at(self):
"""updated_at property"""
return self._updated_at
@property
def mac_address(self):
"""mac_address property"""
return self._mac_address
@property
def battery_level(self):
"""battery_level property"""
return self._battery_level
@property
def last_battery_level_update(self):
"""last_battery_level_update property"""
return self._last_battery_level_update
@property
def sleep_delay(self):
"""sleep_delay property"""
return self._sleep_delay
@property
def is_updated(self):
"""is_updated property"""
return self._is_updated
@property
def power(self):
"""power property"""
return self._power
@classmethod
def from_json(cls, json):
"""return new object from_json"""
return GeoRideTrackerBeacon(
json['id'],
json['linked_tracker_id'],
json['name'],
json['createdAt'],
json['updatedAt'],
json['macAddress'],
json['batteryLevel'],
json['lastBatteryLevelUpdate'],
json['sleepDelay'],
json['isUpdated'],
json['power'])
def update_all_data(self, tracker_beacon):
"""update all data of the tracker beacon from a new object"""
self._name = tracker_beacon.name
self._created_at = tracker_beacon.created_at
self._updated_at = tracker_beacon.updated_at
self._mac_address = tracker_beacon.mac_address
self._battery_level = tracker_beacon.battery_level
self._last_battery_level_update = tracker_beacon.last_battery_level_update
self._sleep_delay = tracker_beacon.sleep_delay
self._is_updated = tracker_beacon.is_updated
self._power = tracker_beacon.power
class GeoRideSubscription:
""" Account object representation """
def __init__(self, subscription_id, subscription_type, initial_date, next_payment_date,
status, paused_since, cancel_requested, price, first_name, last_name, card_information):
self._subscription_id = subscription_id
self._subscription_type = subscription_type
self._initial_date = initial_date
self._next_payment_date = next_payment_date
self._status = status
self._paused_since = paused_since
self._cancel_requested = cancel_requested
self._price = price
self._first_name = first_name
self._last_name = last_name
self._card_information = card_information
@property
def subscription_id(self):
"""subscription_id property"""
return self._subscription_id
@property
def subscription_type(self):
"""subscription_type property"""
return self._subscription_type
@property
def initial_date(self):
"""initial_date property"""
return self._initial_date
@property
def next_payment_date(self):
"""next_payment_date property"""
return self._next_payment_date
@property
def status(self):
"""status property"""
return self._status
@property
def paused_since(self):
"""paused_since property"""
return self._paused_since
@property
def cancel_requested(self):
"""cancel_requested property"""
return self._cancel_requested
@property
def price(self):
"""price property"""
return self._price
@property
def first_name(self):
"""first_name property"""
return self._first_name
@property
def last_name(self):
"""last_name property"""
return self._last_name
@property
def card_information(self):
"""card_information property"""
return self._card_information
@classmethod
def from_json(cls, json):
"""return new object from_json"""
return GeoRideSubscription(
json['id'],
json['type'],
json['initialDate'],
json['nextPaymentDate'],
json['status'],
json['pausedSince'],
json['cancelRequested'],
json['price'],
json['firstName'],
json['lastName'],
GeoRideSubscription_CardInfo.from_json(json['cardInformation'])
)
class GeoRideSubscription_CardInfo:
""" Account object representation """
def __init__(self, last_digits, expiry, brand):
self._last_digits = last_digits
self._expiry = expiry
self._brand = brand
@property
def last_digits(self):
"""last_digits property"""
return self._last_digits
@property
def expiry(self):
"""expiry property"""
return self._expiry
@property
def brand(self):
"""brand property"""
return self._brand
@classmethod
def from_json(cls, json):
"""return new object from_json"""
return GeoRideSubscription_CardInfo(
json['lastDigits'],
json['expiry'],
json['brand']
)
class GeoRideAccount: class GeoRideAccount:
""" Account object representation """ """ Account object representation """
@@ -1045,6 +672,8 @@ class GeoRideAccount:
json['authToken'] json['authToken']
) )
class GeoRideUser: # pylint: disable= R0902 class GeoRideUser: # pylint: disable= R0902
""" User object representation """ """ User object representation """
def __init__(self, user_id, email, first_name, created_at, phone_number, # pylint: disable= R0913 def __init__(self, user_id, email, first_name, created_at, phone_number, # pylint: disable= R0913
@@ -1110,4 +739,96 @@ class GeoRideUser: # pylint: disable= R0902
json['pushUserToken'], json['pushUserToken'],
json['legal'], json['legal'],
json['dateOfBirth'] 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")

View File

@@ -23,6 +23,7 @@ handlers=consoleHandler
qualname=engineio.client qualname=engineio.client
propagate=0 propagate=0
[handler_consoleHandler] [handler_consoleHandler]
class=StreamHandler class=StreamHandler
level=DEBUG level=DEBUG

View File

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