Closed hangll closed 3 years ago
I tried to design the twittergo client so that you can override the HTTP mechanism.
You should be able to set a new http.Client
on the response from twittergo.NewClient
:
https://github.com/kurrik/twittergo/blob/master/twittergo.go#L83
return &Client{
...
HttpClient: &http.Client{
Transport: transport,
},
...
}
http.Client
offers a Timeout
attribute: https://golang.org/pkg/net/http/#Client
So it might be as easy as setting
client := twittergo.NewClient(...)
client.HttpClient.Timeout = ...
See if that helps at all. If not, then look into the various configuration options you have for http.Client
. You should be able to instantiate any new http client and assign it to HttpClient
before making the request.
Recently, I got many following errors: Get https://api.twitter.com/1.1/trends/place.json?id=23424977&exclude=hashtags: read tcp 10. 240.0.7:45520->199.59.148.20:443: read: connection timed out
Should I set a longer timeout in http request (and how)? Or is it caused by other issues?