13 Commits

Author SHA1 Message Date
b6ede1af3b Shipping 0.6.1 2021-05-05 22:43:49 +02:00
6f02f0b925 Fix socketio client to prevent update to 5.0 2021-05-05 22:42:42 +02:00
e38a402d44 Shipping v0.6.0 2021-04-11 17:41:10 +02:00
a05b5bdaa6 Add new tracker fields 2021-04-11 12:42:16 +02:00
3053f2db69 Fix small mistakes 2021-04-10 22:49:21 +02:00
859d962cae Update wording and add new method for tracker 2021-04-10 20:02:44 +02:00
60254999df Small wording fix 2020-12-01 19:49:40 +01: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 125 additions and 24 deletions

1
.gitignore vendored
View File

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

View File

@@ -7,7 +7,7 @@
Official georide website: https://georide.fr/ Official georide website: https://georide.fr/
This library can control your georide tracker tracker This library can control your georide tracker
Some code have been taken from @alexmohr https://github.com/alexmohr/sonyapilib Some code have been taken from @alexmohr https://github.com/alexmohr/sonyapilib

View File

@@ -41,7 +41,7 @@ def example():
thread.start() thread.start()
""" """
account.auth_token = GeorideApi.renewToken(account.auth_token) account.auth_token = GeoRideApi.renewToken(account.auth_token)
print("token 2: ", account.auth_token) print("token 2: ", account.auth_token)
""" # pylint: disable=W0105 """ # pylint: disable=W0105

View File

@@ -109,6 +109,7 @@ def get_user(token):
def get_trackers(token): def get_trackers(token):
""" get user trackers """ """ get user trackers """
headers = {"Authorization": "Bearer " + token} headers = {"Authorization": "Bearer " + token}
response = _SESSION.get( response = _SESSION.get(
GEORIDE_API_HOST + GEORIDE_API_ENDPOINT_TRAKERS, GEORIDE_API_HOST + GEORIDE_API_ENDPOINT_TRAKERS,
@@ -117,6 +118,7 @@ def get_trackers(token):
response_data = response.json() response_data = response.json()
trackers = [] trackers = []
for json_tracker in response_data: for json_tracker in response_data:
_LOGGER.debug(json_tracker)
trackers.append(GeoRideTracker.from_json(json_tracker)) trackers.append(GeoRideTracker.from_json(json_tracker))
return trackers return trackers

View File

@@ -219,34 +219,34 @@ class GeoRideTracker: # pylint: disable=R0904,R0902
longitude, altitude, locked_position_id, locked_latitude, locked_longitude, longitude, altitude, locked_position_id, locked_latitude, locked_longitude,
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): can_send_stolen_signal, status, subscription_id, external_battery_voltage,
internal_battery_voltage, timezone, is_second_gen, is_up_to_date):
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
self._device_button_delay = device_button_delay self._device_button_delay = device_button_delay
self._vibration_level = vibration_level self._vibration_level = vibration_level
self._is_old_tracker = is_old_tracker self._is_old_tracker = is_old_tracker
self._auto_lock_freezed_to = auto_lock_freezed_to
self._fixtime = fixtime
self._role = role
self._last_payment_date = last_payment_date
self._gift_card_id = gift_card_id
self._expires = expires
self._activation_date = activation_date
self._odometer = odometer
self._is_stolen = is_stolen
self._is_crashed = is_crashed
self._crash_detection_disabled = crash_detection_disabled
self._speed = speed
self._moving = moving
self._position_id = position_id self._position_id = position_id
self._fixtime = fixtime
self._latitude = latitude self._latitude = latitude
self._longitude = longitude self._longitude = longitude
self._altitude = altitude self._altitude = altitude
self._locked_position_id = locked_position_id self._locked_position_id = locked_position_id
self._locked_latitude = locked_latitude self._locked_latitude = locked_latitude
self._locked_longitude = locked_longitude self._locked_longitude = locked_longitude
self._role = role
self._last_payment_date = last_payment_date
self._gift_card_id = gift_card_id
self._expires = expires
self._activation_date = activation_date
self._odometer = odometer
self._is_locked = is_locked self._is_locked = is_locked
self._is_stolen = is_stolen
self._is_crashed = is_crashed
self._crash_detection_disabled = crash_detection_disabled
self._speed = speed
self._moving = moving
self._can_see_position = can_see_position self._can_see_position = can_see_position
self._can_lock = can_lock self._can_lock = can_lock
self._can_unlock = can_unlock self._can_unlock = can_unlock
@@ -257,7 +257,13 @@ class GeoRideTracker: # pylint: disable=R0904,R0902
self._can_send_broken_down_signal = can_send_broken_down_signal self._can_send_broken_down_signal = can_send_broken_down_signal
self._can_send_stolen_signal = can_send_stolen_signal self._can_send_stolen_signal = can_send_stolen_signal
self._status = status self._status = status
self._auto_lock_freezed_to = auto_lock_freezed_to
self._subscription_id = subscription_id
self._external_battery_voltage = external_battery_voltage
self._internal_battery_voltage = internal_battery_voltage
self._timezone = timezone
self._is_second_gen = is_second_gen
self._is_up_to_date = is_up_to_date
@property @property
def tracker_id(self): def tracker_id(self):
""" tracker_id """ """ tracker_id """
@@ -338,11 +344,21 @@ class GeoRideTracker: # pylint: disable=R0904,R0902
""" is_stolen """ """ is_stolen """
return self._is_stolen return self._is_stolen
@is_stolen.setter
def is_stolen(self, is_stolen):
""" is_stolen setter"""
self._is_stolen = is_stolen
@property @property
def is_crashed(self): def is_crashed(self):
""" is_crashed """ """ is_crashed """
return self._is_crashed return self._is_crashed
@is_crashed.setter
def is_crashed(self, is_crashed):
""" is_crashed setter"""
self._is_crashed = is_crashed
@property @property
def crash_detection_disabled(self): def crash_detection_disabled(self):
""" crash_detection_disabled """ """ crash_detection_disabled """
@@ -488,6 +504,37 @@ class GeoRideTracker: # pylint: disable=R0904,R0902
""" status """ """ status """
self._status = status self._status = status
@property
def subscription_id(self):
"""subscription_id property"""
return self._subscription_id
@property
def external_battery_voltage(self):
"""_external_battery_voltage property"""
return self._external_battery_voltage
@property
def internal_battery_voltage(self):
"""internal_battery_voltage property"""
return self._internal_battery_voltage
@property
def timezone(self):
"""timezone property"""
return self._timezone
@property
def is_second_gen(self):
"""is_second_gen property"""
return self._is_second_gen
@property
def is_up_to_date(self):
"""is_up_to_date property"""
return self._is_up_to_date
@staticmethod @staticmethod
def from_json(json): def from_json(json):
"""return new object fromjson""" """return new object fromjson"""
@@ -528,9 +575,60 @@ class GeoRideTracker: # pylint: disable=R0904,R0902
json['canSeeStatistics'], json['canSeeStatistics'],
json['canSendBrokenDownSignal'], json['canSendBrokenDownSignal'],
json['canSendStolenSignal'], json['canSendStolenSignal'],
json['status'] json['status'],
None if json['subscriptionId'] == "None" else json['subscriptionId'],
None if json['externalBatteryVoltage'] == "None" else json['externalBatteryVoltage'],
None if json['internalBatteryVoltage'] == "None" else json['internalBatteryVoltage'],
json['timezone'],
json['isSecondGen'],
json['isUpToDate']
) )
def update_all_data(self, tracker):
"""update all data of th tracker from anew object"""
self._tracker_name = tracker.tracker_name
self._device_button_action = tracker.device_button_action
self._device_button_delay = tracker.device_button_delay
self._vibration_level = tracker.vibration_level
self._is_old_tracker = tracker.is_old_tracker
self._position_id = tracker.position_id
self._fixtime = tracker.fixtime
self._latitude = tracker.latitude
self._longitude = tracker.longitude
self._altitude = tracker.altitude
self._locked_position_id = tracker.locked_position_id
self._locked_latitude = tracker.locked_latitude
self._locked_longitude = tracker.locked_longitude
self._role = tracker.role
self._last_payment_date = tracker.last_payment_date
self._gift_card_id = tracker.gift_card_id
self._expires = tracker.expires
self._activation_date = tracker.activation_date
self._odometer = tracker.odometer
self._is_locked = tracker.is_locked
self._is_stolen = tracker.is_stolen
self._is_crashed = tracker.is_crashed
self._crash_detection_disabled = tracker.crash_detection_disabled
self._speed = tracker.speed
self._moving = tracker.moving
self._can_see_position = tracker.can_see_position
self._can_lock = tracker.can_lock
self._can_unlock = tracker.can_unlock
self._can_share = tracker.can_share
self._can_unshare = tracker.can_unshare
self._can_check_speed = tracker.can_check_speed
self._can_see_statistics = tracker.can_see_statistics
self._can_send_broken_down_signal = tracker.can_send_broken_down_signal
self._can_send_stolen_signal = tracker.can_send_stolen_signal
self._status = tracker.status
self._auto_lock_freezed_to = tracker.auto_lock_freezed_to
self._subscription_id = tracker.subscription_id
self._external_battery_voltage = tracker.external_battery_voltage
self._internal_battery_voltage = tracker.internal_battery_voltage
self._timezone = tracker.timezone
self._is_second_gen = tracker.is_second_gen
self._is_up_to_date = tracker.is_up_to_date
class GeoRideAccount: class GeoRideAccount:
""" Account object representation """ """ Account object representation """
def __init__(self, account_id, email, is_admin, auth_token): def __init__(self, account_id, email, is_admin, auth_token):

View File

@@ -1,2 +1,2 @@
[metadata] [metadata]
description-file = README.md description_file = README.md

View File

@@ -19,16 +19,16 @@ 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.5.0', version='0.6.1',
description='Lib to control GeoRide tracker devices with their 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/ptimatth/pyGeoride', url='https://github.com/hacf/georide-api',
download_url='https://codeload.github.com/ptimatth/pyGeoride/tar.gz/0.1.0', 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]"], install_requires=["python-socketio[client]==4.6.1"],
tests_require=[ tests_require=[
'pytest>=3.7', 'pytest>=3.7',
'pytest-pep8', 'pytest-pep8',