Skip to content

tikismoke/xee-sdk-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xee SDK Python

Build Status License Apache Version

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.

Install

  • Clone and python setup.py install :)

Initializing the SDK

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
          	  )
		  )

Using the SDK

Authentication

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

token, error = xee.get_token_from_code(authorization_code)
token, error = xee.get_token_from_refresh_token(token.refresh_token)

Requests

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)

Contributing

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 !

Dependencies

To build this, I used some very useful libraries

And to test

Packages

No packages published

Languages

  • Python 99.4%
  • Makefile 0.6%