gpt4 book ai didi

python - Twython.__init__ 中出现意外的关键字参数

转载 作者:行者123 更新时间:2023-11-30 23:28:44 25 4
gpt4 key购买 nike

请求方式:POST

Django 版本:1.5

异常类型:TypeError

异常值:init() 收到意外的关键字参数“twitter_secret”

设置.py

TWITTER_CONSUMER_KEY = 'mykey'
TWITTER_CONSUMER_SECRET = 'mysecretkey'
TWITTER_OAUTH_TOKEN = 'mytoken'
TWITTER_OAUTH_TOKEN_SECRET = 'mytokensecret'

View .py

from twython import Twython

def publish_tweet(tweet):
twitter = Twython(
twitter_token=settings.TWITTER_CONSUMER_KEY,
twitter_secret=settings.TWITTER_CONSUMER_SECRET,
oauth_token=settings.TWITTER_OAUTH_TOKEN,
oauth_token_secret=settings.TWITTER_OAUTH_TOKEN_SECRET
)
twitter.update_status(status=tweet.text.encode("utf-8"))

最佳答案

查看source code of Twython有效的关键字参数是:app_key、app_secret、oauth_token、oauth_token_secret、access_token、token_type、oauth_version、api_version、client_args 和 auth_endpoint:所以看来您正在编写一些关键字参数名称,这就是您收到错误 ** init() 的原因收到意外的关键字参数“twitter_secret”**。我建议您按照the docs中列出的步骤进行操作。 .

关于python - Twython.__init__ 中出现意外的关键字参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21481434/

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