Unofficial Lyft Rides Python SDK
Python SDK (beta) to support the Lyft Rides API.
Installation
To use the Unofficial Lyft Rides Python SDK:
$ pip install lyft_rides
Head over to pip-installer for instructions on installing pip.
To run from source, you can download the source code for lyft-rides, and then run:
$ python setup.py install
We recommend using virtualenv when setting up your project environment. You may need to run the above commands with sudo if you’re not using it.
Read-Only Use
If you just need access to resources that are not user-specific (eg. ETA, cost, ride types) you will go through a “2-legged” flow. In this case, you can create a Session using ClientCredentialGrant with the Client ID and Client Secret you received after registering your app.
from lyft_rides.auth import ClientCredentialGrant
from lyft_rides.session import Session
auth_flow = ClientCredentialGrant(
YOUR_CLIENT_ID,
YOUR_CLIENT_SECRET,
YOUR_PERMISSION_SCOPES,
)
session = auth_flow.get_session()
Use this Session to create an LyftRidesClient and fetch API resources:
from lyft_rides.client import LyftRidesClient
client = LyftRidesClient(session)
response = client.get_ride_types(37.7833, -122.4167)
ride_types = response.json.get('ride_types')
Example Usage
Navigate to the examples folder to access the python scripts examples. Before you can run an example, you must edit the example/config.yaml file and add your app credentials.
To get an LyftRidesClient through the Authorization Code flow, run:
$ python examples/authorization_code_grant.py
The example above stores user credentials in examples/oauth2_session_store.yaml.
Get Available Products
response = client.get_ride_types(37.7833, -122.4167)
ride_types = response.json.get('ride_types')
ride_type = ride_types[0].get('ride_type')
Request a Ride
response = client.request_ride(
ride_type=ride_type,
start_latitude=37.77,
start_longitude=-122.41,
end_latitude=37.79,
end_longitude=-122.41,
)
ride_details = response.json
ride_id = ride_details.get('ride_id')
This does not make a real-time request. It makes a request to the sandbox environment.
To send a real-time request to send a Lyft driver to the specified start location, make sure to instantiate your ClientCredentialGrant with
auth_flow = ClientCredentialGrant(
YOUR_CLIENT_ID,
YOUR_CLIENT_SECRET,
YOUR_PERMISSION_SCOPES,
sandbox_mode=False)
or AuthorizationCodeGrant with
auth_flow = AuthorizationCodeGrant(
YOUR_CLIENT_ID,
YOUR_CLIENT_SECRET,
YOUR_PERMISSION_SCOPES,
sandbox_mode=False,
)
The default for sandbox_mode is set to True. See the documentation to read more about using the Sandbox Environment.
Getting help
For full documentation about Lyft Rides API, visit the Lyft Developer Site.
Contributing
If you’ve found a bug in the library or would like new features added, go ahead and open issues or pull requests against this repository.
Metadata
Release files for lyft_rides 0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lyft_rides-0.2.tar.gz | 17.1 kB | Without provenance | Details for lyft_rides-0.2.tar.gz |
Release files / lyft_rides-0.2.tar.gz
| Download URL | lyft_rides-0.2.tar.gz |
|---|---|
| Size | 17.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
36b2bab971814c4a9bb14f7f02b3c5a5594ed1519ee34872fde9a6167694cc8a
|
|
BLAKE2b-256 checksum How to use checksums |
bb1f907e932ff73a7a96fb256d70f16a0d41d2d3c4fc17c9a74ee42fb42b11bb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for lyft_rides 0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.