mmohades/Venmo

Could not make the request because -> 403 Forbidden

Closed this issue ยท 6 comments

Do you know if Venmo updated their API recently?

I've been using your package for the past 6 months or so and haven't changed any code but noticed I'm now getting a 403 error ๐Ÿค”

  File "/home/runner/work/monthly-venmo/monthly-venmo/health.py", line 97, in <module>
    main(now)
  File "/home/runner/work/monthly-venmo/monthly-venmo/health.py", line 22, in main
    venmo = Venmo(access_token)
  File "/home/runner/work/monthly-venmo/monthly-venmo/utils.py", line 65, in __init__
    self.client = Client(access_token=access_token)
  File "/opt/hostedtoolcache/Python/3.9.8/x64/lib/python3.9/site-packages/venmo_api/venmo.py", line 15, in __init__
    self.__profile = self.user.get_my_profile()
  File "/opt/hostedtoolcache/Python/3.9.8/x64/lib/python3.9/site-packages/venmo_api/apis/user_api.py", line 26, in get_my_profile
    response = self.__api_client.call_api(resource_path=resource_path,
  File "/opt/hostedtoolcache/Python/3.9.8/x64/lib/python3.9/site-packages/venmo_api/utils/api_client.py", line 58, in call_api
    return self.__call_api(resource_path=resource_path, method=method,
  File "/opt/hostedtoolcache/Python/3.9.8/x64/lib/python3.9/site-packages/venmo_api/utils/api_client.py", line 103, in __call_api
    processed_response = self.request(method, url, session,
  File "/opt/hostedtoolcache/Python/3.9.8/x64/lib/python3.9/site-packages/venmo_api/utils/api_client.py", line 139, in request
    validated_response = self.__validate_response(response, ok_error_codes=ok_error_codes)
  File "/opt/hostedtoolcache/Python/3.9.8/x64/lib/python3.9/site-packages/venmo_api/utils/api_client.py", line 170, in __validate_response
    raise HttpCodeError(response=response)
venmo_api.models.exception.HttpCodeError: HTTP Status code is invalid. Could not make the request because -> 403 Forbidden.
Error: Invalid Json

Link to error
Link to code

Possibly related zackhsi/venmo#55

I'm not sure, but yeah it can be caused by a change in their API. I'll have to look into it over the weekend.

I just tried the API on my end with a few different accounts and endpoints, and it works fine. Can you please check your access token you are passing to the Client() to be valid? Perhaps by running something locally with it. Like this:

  token = "your token"
  client = Client(token)
  users = client.user.search_for_users("James", limit=3)
  for user in users:
      print(user)
  print("My profile: ", client.my_profile())

Thanks for confirming! My script run just fine about 23 hours ago.

image

Looks like it may have been a one-time hiccup. Sorry for the noise! (thanks again for the library!)

I literally pasting the code you added as example and I am getting errors, I want to payout multiple users, but I can't query the users model to get the user ID I can see the access token
The bottom of the traceback reads

venmo_api.models.exception.HttpCodeError: HTTP Status code is invalid. Could not make the request because -> 503 Service Temporarily Unavailable.
Error: Invalid Json

Encountering the same issue as @tochimclaren

Same issue as the ones above, I think Venmo restricted developer mode, and (at least for me) I can't seem to find the access tokens anymore. Anyone know anything about this?

edit: see here https://venmo.com/gettingstarted/overview/#:~:text=Our%20Venmo%20Developer%20and%20Payouts,%2Dvenmo%2Din%2Dstores.