gpt4 book ai didi

python - 使用 Python 的 Twitter API 出现问题

转载 作者:行者123 更新时间:2023-12-01 06:10:51 25 4
gpt4 key购买 nike

我在这段 python 代码中遇到了一些问题:

import twitter
twitter_search = twitter.Twitter(domain="search.twitter.com")
trends = twitter_search.trends()

错误(未找到 404 页面)就在这里: enter image description here

我正在使用这个包:http://github.com/sixohsix/twitter

最佳答案

由于新的 API 更改,您需要使用此程序:

import twitter
twitter_api = twitter.Twitter(domain="api.twitter.com", api_version='1')
WORLD_WOE_ID = 1
world_trends = twitter_api.trends._(WORLD_WOE_ID)
trends = world_trends()
print [trend['name'] for trend in trends[0]['trends']]

这部分基于 book errata website .

关于python - 使用 Python 的 Twitter API 出现问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5996728/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com