in example/request_ride.py [0:0]
def request_ufp_ride(api_client):
"""Use an UberRidesClient to request a ride and print the results.
Parameters
api_client (UberRidesClient)
An authorized UberRidesClient with 'request' scope.
Returns
The unique ID of the requested ride.
"""
try:
estimate = api_client.estimate_ride(
product_id=UFP_PRODUCT_ID,
start_latitude=START_LAT,
start_longitude=START_LNG,
end_latitude=END_LAT,
end_longitude=END_LNG,
seat_count=2
)
fare = estimate.json.get('fare')
request = api_client.request_ride(
product_id=UFP_PRODUCT_ID,
start_latitude=START_LAT,
start_longitude=START_LNG,
end_latitude=END_LAT,
end_longitude=END_LNG,
seat_count=2,
fare_id=fare['fare_id']
)
except (ClientError, ServerError) as error:
fail_print(error)
return
else:
success_print(estimate.json)
success_print(request.json)
return request.json.get('request_id')