Unauthorized error accessing the streaming service


#1

I have developed some code using Python and the Twitter Streaming service. My app connects and requests all geolocated tweets. Until about a week ago, this had been working just fine. This week, it’s now returning an “Unauthorized” error (http response 401). The strange thing is that this is only affecting our “production-ish” server. When I run the same Python code on my desktop, it works just fine. The error text I’m getting on the production server is:

\n\n\nError 401 Unauthorized

HTTP ERROR: 401

Problem accessing '/1.1/statuses/filter.json?locations=-180%2C-90%2C180%2C90'. Reason:

    Unauthorized

Exact same API key, Tokens, and secrets in both places! Any thoughts on what might be causing this? I was thinking it might be that our server IP was blocked, but the Twitter description of being blocked suggests no response from their server, not “Unauthorized”. I’ve re-installed the exact same Python TwitterAPI libraries on both machines – just to be sure the same code is running in both places.

Thanks,
Carl


#2

Carl,

This may be a shot in the dark, but can you check whether your server is in sync with one of the major time servers (using NTP or equivalent)? OAuth signature relies on this, and a failure to generate the correct signature will result in a 401.

If this does not solve the issue, there’s something very funky going on with your token.


#3

Thank you! That was my problem. This particular machine had been unable to reach ntp, and had drifted far enough from the right time (about 8 minutes) that it was no longer compliant.

  • Carl

#4

SebRenauld
you are a god send !!!
thank you that resolved my problem…
Regards