无法获取伊朗的Twitter趋势

2024-04-29 05:42:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我想使用python和thisTwitter包从Twitter api获取伊朗的Twitter趋势:

import twitter

#WOE_ID Obtained from http://woeid.rosselliot.co.nz/lookup/iran
IR_WOE_ID = 23424851

auth = twitter.oauth.OAuth(OAUTH_TOKEN, OAUTH_TOKEN_SECRET,
CONSUMER_KEY, CONSUMER_SECRET)
twitter_api = twitter.Twitter(auth=auth)

print twitter_api

ir_trends = twitter_api.trends.place(_id=IR_WOE_ID)

print ir_trends

作为回应,我得到

twitter.api.TwitterHTTPError: Twitter sent status 404 for URL: 1.1/trends/place.json using parameters: (id=2251945&oauth_consumer_key=***&oauth_nonce=***&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1530506965&oauth_token=***&oauth_version=1.0&oauth_signature=***)
details: {u'errors': [{u'message': u'Sorry, that page does not exist.', u'code': 34}]}

对于其他的WOE\u ID国家代码,比如IndiaUS,我没有发现任何错误。你知道吗

这里可能有什么问题?我怎样才能解决这个问题?你知道吗


Tags: tokenauthapiidsecretirconsumertwitter