xdevplatform/twitter-python-ads-sdk

Problem with OAuth1Session in http.py

Opened this issue · 1 comments

Our pipeline was working fine until last Friday (28/07/2023) when it start giving us issues when we were fetching async stats job data.
After a lot of debugging I was able to pinpoint the issue to row 110 in http.py, which uses OAuth1Session.get method in our specific case. Basically it gives us back an unauthorised error 403 when we were trying to get a gzip file trough this method, which worked fine in the past. More strangely if I paste the URL of the request in any browser, even in incognito, I'm able to download the file without any issues, it's like it doesn't even need any authorisation.
I made a small change in the code just to test if this was a problem of the SDK or if it was a problem with our developer account as you can see in the following image and I was able to make the pipeline work again.
image

As you can see I've used the requests library to replace the OAuth1Session.get method and I was able to surpass the issue. So in conclusion there seems to be a problem with the usage of OAuth1Session.get method for async stats job data.

nbro10 commented

@antoniosequeiraws The Twitter Ads API apparently changed and this package is dead (unmaintained), so now there's this and maybe other bugs in it. The async report is now public and you should not make an authenticated request to download it. Just download it normally with a custom function (e.g. with requests and gzip)