Search code examples
pythonuber-api

KeyError: u'x-rate-limit-limit'


I'm trying to use the Uber API in Python but I can't even get the basic commands to work. I'm following the code suggested on the GitHub page (https://github.com/uber/rides-python-sdk).

from uber_rides.session import Session
session = Session(server_token='xxxxxx')

from uber_rides.client import UberRidesClient
client = UberRidesClient(session)
response = client.get_products(37.77, -122.41)
products = response.json.get('products')

When I run this I get the following error - KeyError: u'x-rate-limit-limit'

I did make a developer account with Uber and I've tried using different Server Tokens, but none of them work.

Can anyone help?


Solution

  • You are experiencing an issue that was resolved with the latest SDK fix (GitHub issue). This has happened because the Python SDK was upgraded to use the v1.2 endpoints of the Uber API. However, with the upgrade to v1.2 Uber also deprecated the rate limiting headers (X-Rate-Limit-Limit, X-Rate-Limit-Remaining, X-Rate-Limit-Reset). The older SDK version is still using them. That's what causing you trouble.

    In order to resolve your issue, please install the newest SDK version (> 0.2.7.1).