xdevplatform / twitter-python-ads-sdk

A Twitter supported and maintained Ads API SDK for Python.
https://twitterdev.github.io/twitter-python-ads-sdk/
MIT License
189 stars 106 forks source link

Add GatewayTimeout to defined errors #243

Closed ariarijp closed 4 years ago

ariarijp commented 4 years ago

Hi, I found undefined key error in SDK.

[ERROR] KeyError: 504
Traceback (most recent call last):

...snip(our private code paths are included)...

  File "/var/task/twitter_ads/analytics.py", line 116, in async_stats_job_data
    raw_body=True, stream=True).perform()
  File "/var/task/twitter_ads/http.py", line 69, in perform
    raise Error.from_response(response)
  File "/var/task/twitter_ads/error.py", line 45, in from_response
    return ERRORS[response.code](response)

I guess we should care 504 error for the better developer experiece.

smaeda-ks commented 4 years ago

@ariarijp Thanks. Which version did you test this? https://github.com/twitterdev/twitter-python-ads-sdk/pull/233 This PR should prevent the KeyError if I understand it correctly.

ariarijp commented 4 years ago

@smaeda-ks Oh, we are using 6.0.1. I'll try to upgrade to 6.1.0 or higher in the next year.

However, I think GatewayTimeout class is useful for the future. If you don't need it at this time, please feel free to close this PR.

Thank you,