在Python和googleappengin中调用twitterapi和身份验证

2024-04-24 22:59:44 发布

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

如何在我的项目(Python flask和google app engine)中验证和调用twitter api

这是我的密码:

twitter = OAuth1Session(TW_CONSUMER_KEY, TW_CONSUMER_SECRET,  
TW_ACCESS_TOKEN, 
TW_ACCESS_TOKEN_SECRET)
params = {
            "q" : "xxxxxxxxx",
            "lang": "ja",
            "locale": "ja",
            "since_id":"xxxxxxxxxxxx"
}
req = self.twitter.get("https://api.twitter.com/1.1/search/tweets.json", 
params = params)

我这样打电话,我得到以下错误:

raise ConnectionError(err, request=request)
ConnectionError: ('Connection aborted.', error(13, 'Permission denied'))

但这段代码在python(命令行)中运行良好


Tags: 项目tokenapiappflasksecretaccessconsumer