AttributeError: 'str' object has no attribute 'is_stale'

574 Views Asked by At

When I run my code, I get this error: AttributeError: 'str' object has no attribute 'is_stale'. Any idea what's going wrong?

Code:

from uber_rides.session import Session   
from uber_rides.client import UberRidesClient

ACCESS_TOKEN = "[redacted]"

session = Session(oauth2credential=ACCESS_TOKEN)
client = UberRidesClient(session)

response = client.get_products(37.77, -122.41)

Error message:

Traceback (most recent call last):
  File "/Users/slandeta/uber/uber_api.py", line 8, in <module>
    response = client.get_products(37.77, -122.41)
  File "/Users/slandeta/opt/anaconda3/lib/python3.9/site-packages/uber_rides/client.py", line 127, in get_products
    return self._api_call('GET', 'v1.2/products', args=args)
  File "/Users/slandeta/opt/anaconda3/lib/python3.9/site-packages/uber_rides/client.py", line 96, in _api_call
    self.refresh_oauth_credential()
  File "/Users/slandeta/opt/anaconda3/lib/python3.9/site-packages/uber_rides/client.py", line 718, in refresh_oauth_credential
    if credential.is_stale():
AttributeError: 'str' object has no attribute 'is_stale'
0

There are 0 best solutions below