【问题标题】:https://api.twitter.com/oauth/request_token : Connection Timeouthttps://api.twitter.com/oauth/request_token :连接超时
【发布时间】:2016-10-29 08:27:49
【问题描述】:
org.springframework.web.client.ResourceAccessException:“https://api.twitter.com/oauth/request_token”的 POST 请求出现 I/O 错误:连接超时;嵌套异常是 java.net.SocketException: Connection timed out
在 org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:607)
在 org.springframework.web.client.RestTemplate.execute(RestTemplate.java:572)
在 org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:493)
在 org.springframework.social.oauth1.OAuth1Template.exchangeForToken(OAuth1Template.java:192)
【问题讨论】:
标签:
java
twitter-oauth
spring-social
【解决方案1】:
我在 Python 程序中遇到了完全相同的问题。
发布https://www.twitter.com/oauth/request_token
请求头与此类似:
headers= {'Authorization': 'OAuth oauth_nonce="4df3da1d-18e1-4ea7-a9ac-03374483d6f2", oauth_timestamp="1486140325", oauth_version="1.0", oauth_signature_method="HMAC-SHA1", oauth_consumer_key="*****************", oauth_callback="http%3A%2F%example.com%3A8888%2Fauth%2Ftwitter", oauth_signature="***********************"'}
结果:
tornado.httpclient.HTTPError: HTTP 599: Timeout