Released:
Official Uber API Python SDK
Official Uber API Python SDK. Skip to main content Switch to mobile version. 0.5.1 Aug 18, 2017 0.5.0 Aug 17, 2017 0.4.1. The Uber #1 Insignia Set was one of the rarest special edition sets ever offered on Uber. Here we have all three of the books CGC certified 9.8 and signed by Kieron Gillen and Caanan White! We thank you once again for going that extra mile to help us reach our goal and congratulations for getting an amazing batch of collectibles!
Python SDK (beta) to support the Uber Rides API.
To use the Uber Rides Python SDK:
Head over to pip-installer for instructions on installing pip.
To run from source, you can download the source code for uber-rides, and then run:
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.
If you just need read-only access to Uber API resources, like getting a location’s available products, create a Session with the server token you received after registering your app.
Use this Session to create an UberRidesClient and fetch API resources:
If you need to access protected resources or modify resources (like getting a user’s ride history or requesting a ride), you will need the user to grant access to your application through the OAuth 2.0 Authorization Code flow. See Uber API docs.
The Authorization Code flow is a two-step authorization process. The first step is having the user authorize your app and the second involves requesting an OAuth 2.0 access token from Uber. This process is mandatory if you want to take actions on behalf of a user or access their information.
You can find YOUR_CLIENT_ID and YOUR_CLIENT_SECRET in the developer dashboard under the settings tab of your application. YOUR_PERMISSION_SCOPES is the list of scopes you have requested in the authorizations tab. Note that YOUR_REDIRECT_URL must match the value you provided when you registered your application.
Navigate the user to the auth_url where they can grant access to your application. After, they will be redirected to a redirect_url with the format YOUR_REDIRECT_URL?code=UNIQUE_AUTH_CODE. Use this redirect_url to create a session and start UberRidesClient.
Keep credentials information in a secure data store and reuse them to make API calls on behalf of your user. The SDK will handle the token refresh for you automatically when it makes API requests with an UberRidesClient.
Navigate to the example folder to access the python example apps. Before you can run an example, you must edit the example/config.*.yaml file and add your app credentials from the Uber developer dashboard.
To get an UberRidesClient through the Authorization Code flow, run:
The example above stores user credentials in example/oauth2_rider_session_store.yaml. To create an UberRidesClient with these credentials and go through a surge ride request run:
—
To get an UberRidesClient authorized for driver endpoints, run:
The example above stores user credentials in example/oauth2_driver_session_store.yaml.
To get an understanding of how the sdk can be use in an example app see the flask examples for rider and driver dashboards:
This makes a real-world request and send an Uber driver to the specified start location.
To develop and test against request endpoints in a sandbox environment, make sure to instantiate your UberRidesClient with
The default for sandbox_mode is set to False. See our documentation to read more about using the Sandbox Environment.
If you are requesting sandbox rides, you will need to step through the different states of a ride.
If the update is successful, response.status_code will be 204.
The update_sandbox_ride method is not valid in normal mode, where the ride status will change automatically.
Uber developers actively monitor the Uber Tag on StackOverflow. If you need help installing or using the library, you can ask a question there. Make sure to tag your question with uber-api and python!
For full documentation about our API, visit our Developer Site.
See the Getting Started Tutorial.
We love contributions. 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 repo. Write a test to show your bug was fixed or the feature works as expected.
0.6.0
0.5.3
0.5.2
0.5.1
0.5.0
0.4.1
0.4.0
0.3.1
0.3.0
0.2.7
0.2.6
0.2.5
0.2.4
0.2.3
0.2.2
0.2.1
0.2.0
0.1.1
0.1.0
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size uber_rides-0.6.0-py2.py3-none-any.whl (57.9 kB) | File type Wheel | Python version 2.7 | Upload date | Hashes |
Filename, size uber_rides-0.6.0.tar.gz (103.4 kB) | File type Source | Python version None | Upload date | Hashes |
Algorithm | Hash digest |
---|---|
SHA256 | bf41aa8c521e0581dd4de810235811fe76c315c05723f64796580dead068aa4f |
MD5 | fde2aa07f914fc282b4b84ce3d405062 |
BLAKE2-256 | 26a7a7263ab7a8dfe6c0aa435ca86623f6215fcfbf17082dd95c92e22a3b959a |
Algorithm | Hash digest |
---|---|
SHA256 | adca8a529e631efed61f6d59753d09f58cdd274ef66d1ebeb514a1afc9299b60 |
MD5 | 509edf2835ce8c922ed5a6f2f5946132 |
BLAKE2-256 | 70731d8751d32da910cfb751e7e33fe6dba062560e8fa6467aea43abdee2ae56 |
Do you want to find out how much your Uber will cost before you request it? You might not want to get an Uber ride if you don’t know how much the ride is going to cost. Will your ride be $5 or $50? Luckily, Uber provides up-front cost estimates right inside the app, or a range of prices.
To get a fare estimate, download the Uber app (our referral link) and input your destination. After you input your destination, the app will display a fare estimate for each service.Disclosure: Download link is my referral link and I may receive a commission for referring you.
How does Uber come up with the cost of a ride, and what else do you need to know about the cost of an Uber before you request a ride? This article explains how Uber pricing works, and how the ride type you choose determines the cost of your ride.
Uber uses two pricing models: One is a calculation based on trip distance and time, and the other is an ‘upfront’ pricing model that is a more complicated algorithm based on willingness to pay and other factors.
In markets that charge based on distance and time, the Uber fare is calculated on these criteria:
Here’s how Uber calculates your fare:
Base Fare + (Cost per minute * time in ride) + (Cost per mile * ride distance) + Booking Fee + Other Fees = Your Fare
In many markets, Uber uses an up-front pricing model that tells you how much you’ll pay as soon as you enter your destination. All you have to do is input your destination to see how much your ride will cost.
Before up-front pricing, it was easy to figure out why your Uber cost as much as it did because it was based on the above mileage + time equation. With up-front pricing, the pricing calculation has become less clear. Up front prices are still based on mileage and time, but they also include other unstated algorithmic calculations that aren’t clearly disclosed and explained.
Enter your destination to get a price estimate
Beginning in January 2020, Uber eliminated Up-Front pricing in California in an attempt to comply with new regulations that apply to Uber drivers. When you request a ride in California, you will now see a range of prices instead of an exact up-front price.
Ride pricing in California is now based on the mileage+time fare calculation listed above. You won’t know exactly how much your ride costs until the ride is over, but it should be close to the estimated range.
To give you a feel for the range of Uber fare costs, here’s a look at the fare costs in Los Angeles. LA features almost every Uber service and the prices aren’t much higher or much lower than other US Uber markets.
Cost Per Mile | Cost Per Minute | Base Fare | Booking Fee | Minimum Fare | |
---|---|---|---|---|---|
Uber Pool | $.80 | $0.28 | $0 | $2.30 | $0 |
Uber X | $0.80 | $0.28 | $0 | $3 | $6.50 |
Uber Comfort | $0.92 | $0.38 | $0 | $3 | $10 |
Uber XL | $1.61 | $0.31 | $1 | $3 | $9 |
Uber Select | $1.90 | $0.61 | $5 | $3 | $12 |
Uber Black | $2.92 | $0.71 | $8.75 | $0 | $15.75 |
Black SUV | $3.76 | $0.75 | $15.75 | $0 | $25.75 |
To see see the exact Uber rates for your city, visit Uber.com/ride.
Uber prices depend on the city you’re in and the Uber service you use. Uber rates are different for UberX, XL, UberSelect, Black Car,and SUV. Read more about the differences between the Uber ride types.
The table below is the cost of an example ride. It shows that the same ride has a different price depending on the service you choose.
Note: This ride is 2.3 miles and 11 minutes long. The price may change due to time of day, traffic conditions, discounts, or surge pricing.
Uber Ride Type | Ride Cost (2.3 miles, 11 minutes) |
---|---|
Pool | $7-$9 |
X | $8-$10 |
Comfort | $10-$12 |
XL | $11-$13 |
Select | $19-$22 |
Black | $23-$27 |
Black SUV | $32-$37 |
Uber sets a minimum fare for each service to help fairly reimburse drivers for short rides. If the sum of the equation above is lower than the minimum fare, you’ll still be charged the minimum fare.
For example: You take an UberX two blocks down the street. After you added up the variables, you calculated that your fare would only be $3.87. But in your area, the minimum fare for UberX is $6.50, so you will be charged $6.50 instead of $3.87.
During times of high rider demand, Uber may add a cost multiplier to the cost of your trip that is known as surge pricing, or dynamic pricing. In the past, Uber displayed a popup screen before you requested a ride letting you know that surge pricing is active, and how much the multiplier is.
Surge pricing changes dynamically depending on driver supply and rider demand. If the cost of your ride seems abnormally high, you can wait and see if the price goes down after a few minutes.
Uber has an optional tipping feature that allows you to tip your driver electronically. Drivers keep 100% of the tip you leave. Tipping hasn’t always been customary for most Uber passengers, but many drivers expect and appreciate a tip.
There are two ways to tip your driver: During the trip, or after. During the trip, you can swipe up to see more info about your trip and the driver. A tipping option will be there.
To tip after your trip is over, rate the driver and then select a tip amount.
There are two ways to see how fare rates break down for each Uber service in your city: Through Uber desktop site, or inside the Uber app.
There are several fees and tolls that you should be aware of before you request an Uber ride. Most importantly, the cancellation fee is a fee charged to you if you cancel a ride two minutes after requesting it, or if you take 5 minutes or longer to come out to the driver after they have arrived. The cancellation fee is typically around $5.
The cost of any tolls are passed onto the passenger, so if your driver takes a toll road, the cost of the toll will be added to your final ride price. You will not have to give the driver cash or coins to pay for the toll.
There are several ways to save money on Uber rides.
Promo codes: All new users can input a promo code that typically offers a discount on your first ride. Our code ‘cws7s2’ works for all new users, and you can find similar codes online.
Uber Rewards: Uber has a customer rewards program that offers benefits and ride credits as you earn more points. Earn points by taking rides or ordering food on Uber Eats. Each 500 points offers a reward in Uber cash, and an upgrade to the next reward tier. Benefits of higher tiers include: Flexible cancellations, free ride upgrades, and improved customer support.
Credit card promotions: Some credit cards have partnered with Uber to offer benefits to card holders. Amex Platinum users get $15 in Uber cash each month. Apple card users gets 3% cash back on Uber rides. Use a Visa card at featured restaurants and stores to get Uber cash back.
Temporary promotions: Uber will occasionally run promotions that offer discounts on rides, or discounts on fees. Keep an eye out in your Uber app to see temporary promotions.
Use a qualifying credit card to earn Uber cash back
The Uber app allows you to schedule a ride request in advance. On the home screen, tap the clock + car icon next to the “Where To?” search bar to schedule a ride. Next, you pick the date, time, and pickup & drop off location. Although Uber calls it a scheduled ride, it is actually an automated request that goes off at the time you schedule. When you schedule a ride in the Uber app, a driver does not get information about your fare in advance and prepare for it.
At the time of your scheduled ride, your account automatically sends a ride request, and to nearby drives it appears as an ordinary ride request. If there are no drivers around, you won’t get a ride even though you schedule it! So if you need an early morning ride to the airport, it might be better to open the app 20 minutes before you need to leave just to make sure drivers are nearby.
If you’ve never tried Uber before and you want to know how much your ride will cost, download the app, input my promo code ‘cws7s2′ (works for USA only) then tap fare estimator. My promo code will give you $20 off your first ride, and I may also receive a commission or app credit for referring you.