JLugao
JLugao

Reputation: 346

Ride history prices on UBER API

I am trying the UBER API using the python library. My goal is to make a simple project where I export my rides history to an excel file and this will help automate the creation of expenses reports I have to make for the company I work for.

Everything is working fine, except that I can`t find in the documentation how can I get the ride value (price and currency). Is this an intentional limitation of the API? Or am I looking at the wrong places for this information?

The main loop to get the info:

rides = []
i = 0
while True:
    resp = client.get_user_activity(limit=50, offset=i)
    i += 50
    if len(resp.json['history']) > 0:
        rides += resp.json['history']
    else:
        break

Regards, John

Upvotes: 1

Views: 1186

Answers (1)

lucasnadalutti
lucasnadalutti

Reputation: 5948

You could retrieve this data through the receipts endpoint, although this would require that all the Uber requests in your company were made from your application, as stated in this endpoint's documentation.

The receipt endpoint will only provide receipts for ride requests originating from your application. It is not currently possibly to receive receipt data for all trips.

That said, if it's possible to get your company to request rides through your application, you could use this endpoint to fetch the data you want. If this is not possible, then you cannot do what you want with their standard JSON API. It is, however, possible using their Data Automation feature, which is premium unfortunately.

You are able to retrieve every trip fare from daily files, as well as manage expenses which seems to be exactly what you're trying to achieve.

Upvotes: 3

Related Questions