A utility library for Xee API with Python 3, using V4 API.
Almost all the requests are done for you and the responses are returned as a tuples.
- Clone and
python setup.py install
:)
from xee import Xee
xee = Xee(client_id="your_client_id",
client_secret="your_client_secret",
redirect_uri="your://redirect:uri",
scope=(
AuthScope.VEHICLES_READ,
AuthScope.VEHICLES_READ_SIGNALS,
AuthScope.VEHICLES_READ_LOCATIONS,
AuthScope.VEHICLES_READ_EVENTS,
AuthScope.VEHICLES_READ_ACCELEROMETERS,
AuthScope.VEHICLES_READ_DEVICE_DATA,
AuthScope.ACCOUNT_READ,
AuthScope.VEHICLES_MANAGEMENT
)
)
Getting the access code url
login_url = xee.get_authentication_url()
Then show the webpage to the end user, once the process is complete, we'll redirect to
redirect_uri?code={authorization_code}
. Keep this code in mind
Getting a token from an authorization_code
token, error = xee.get_token_from_code(authorization_code)
Getting a token from an refresh_token
token, error = xee.get_token_from_refresh_token(token.refresh_token)
As simple as
user, error = xee.get_user(token.access_token)
print(user.id)
Others examples:
status, error = xee.get_status(carId, token.access_token)
print(status)
signal, error = xee.get_signals(carId, token.access_token)
print(signal)
trip_duration, error = xee.get_trip_duration(tripId, token.access_token)
print(trip_duration.value)
I'm pretty new to python.
Tried to follow some "guidelines" I found:
But might be doing things in a wrong way so, feel free to fork, issue, pr, everything to improve this !
To build this, I used some very useful libraries
And to test