python token过期_python – 令牌无效或过期.通过Tweepy申请新令牌?

不确定您的应用的目标是什么,但要回答您的一些问题 – 关注:

Do tokens have to be hard coded?

不,根据您编码的应用程序的性质,您可以在通过webform执行程序时请求此数据,或者在GUI中将文本字段包含在另一个文件中并对其进行加密或导入其所在的文件并使用它. .

I have the OAuth and access tokens hard coded right now, but the token

seems to expire every 24 hours. What can I do to renew the token

programatically?

POST oauth/request_token Allows a Consumer application to obtain an

OAuth Request Token to request user authorization. This method

fulfills Section 6.1 of the OAuth 1.0 authentication flow. It is

strongly recommended you use HTTPS for all OAuth authorization steps.

Usage Note: Only ASCII values are accepted for the oauth_nonce

关于访问令牌到期:

How long does an access token last? We do not currently expire access

tokens. Your access token will be invalid if a user explicitly rejects

your application from their settings or if a Twitter admin suspends

your application. If your application is suspended there will be a

note on your application page saying that it has been suspended. as

per twitter:

What do I do if an access token I have becomes invalid? You should

plan that a user’s access token may become invalid at any time and you

will need to re-authorize for that user in the case that it does.

Ensuring you handle this situation gracefully is imperative for a

quality user experience.

API请求包含无效的承载令牌

使用不正确或已撤销的承载令牌发出API请求将导致:

HTTP / 1.1 401未经授权

Content-Type:application / json;字符集= utf-8的

内容长度:61

{“errors”:[{“message”:“令牌无效或过期”,“代码”:89}]}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值