NOTE This library hasn't been updated in a while and it probably will not be worked on for a while (maybe never). I'm happy for people to pick this up and take it forward.
A python based wrapper for [Uber's public API] (https://developer.uber.com/).
It provides flexibility to retrieve JSON responses from the API as well as translating them to objects.
This package requires Python 2.5+
Essential requirements-
To install by downloading the source:
sudo python setup.py install
Alternatively, using pip:
Credentials can be obtained from [Uber's API website] (https://developer.uber.com/) This includes a client_id, secret, and server_token.
For the initial version, only the server_token is required as OAuth 2.0 is currently not implemented. Future versions will, however support OAuth 2.0.
Check out the latest official [API documentation] (https://developer.uber.com/v1/endpoints/) for a detailed reference.
First, import uberipy:
Create a new Uber instance as follows:
uber = Uber(client_id, server_token, secret)
This will give access to the underlying API methods.
GET /v1/products - get_products(latitude, longitude)This method returns a list of all the products that are available in the area based on location coordinates.
Parameters
Usage
latitude = 51.5286416 longitude = -0.1015987 uber_products = uber.get_products(latitude, longitude) # Do something with itGET /v1/estimates/price - get_price_estimate(start_latitude, start_longitude, end_latitude, end_longitude)
This method returns an estimate of the fare for a trip between two locations.
Parameters
Usage
start_latitude = 51.5252162 start_longitude = -0.1036919 end_latitude = 51.5049949 end_longitude = -0.0103968 fare_estimate = uber.get_fare_estimate(start_latitude, start_longitude, end_latitude, end_longitude) # Do something with itGET /v1/estimates/time - get_time_estimate(start_latitude, start_longitude, customer_uuid, product_id)
Get the estimated time of arrival of a Uber product.
Parameters
Usage
start_latitude = 51.5252162 start_longitude = -0.1036919 time_estimate = uber.get_time_estimate(start_latitude, start_longitude, customer_uuid=None, product_id=None) # Do something with itGET /v1/promotions - get_promotions(start_latitude, start_longitude, end_latitude, end_longitude)
Returns the promotions that will be available to a new user based on their location.
Parameters
Usage
start_latitude = 51.5252162 start_longitude = -0.1036919 end_latitude = 51.5049949 end_longitude = -0.0103968 promotions = uber.get_promotions(start_latitude, start_longitude, end_latitude, end_longitude) # Do something with it
To run the tests, you will have to obtain
Add them to the tests before you run them. You can always comment out the tests you dont want.
There are a few possible exceptions that can be thrown based on the error codes sent back by the API. You can look out for these errors when implementing.
Functions to create Uber objects to extend classes and provide flexibility.
Currently, the library does not include any of the OAuth requiring API calls.
These include
[Vivan] (https://github.com/vivangkumar)
This code is licenced under the MIT Licence
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4