Reputation: 63
I'm using tweepy for sending tweets, so far so good. in the last 10 minutes, for some reason, twitter.com isn't working for me, but that's not the issue. The issue is, that in this situation,
api.update_status(msg)
takes a loooong time(1 min approximately) before the error raised.
[Errno 10060] A connection attempt failed..
How can I set the time out for lets say 3-5 sec, so if after 5 sec twitter.com isn't working, it will raise error 10060 right away?
I tried, without success:
api.update_status(msg, timeout=5)
Upvotes: 5
Views: 3025
Reputation: 7671
You have to set the timeout
attribute when initializing the API, not when using a status method:
api = tweepy.API(timeout=5) #default=60
For some reason this option isn't listed in the official documentation, but you can find it in the actual code.
Upvotes: 5