无法 url 编码冒号“:”当调用 twitter api 创建帖子

问题描述

我正在尝试创建一条推文,但在有冒号时似乎失败了,在本例中为 hello:

https://api.twitter.com/1.1/statuses/update.json?status=hello: this would have been a cool tweet

我也尝试过使用 %3A 进行百分比编码,但 twitter 继续给我一个 401删除冒号时,它工作正常。

有什么想法吗?我最终试图在推特上发布一个May 01,2021 12:07:21

这样的时间戳

解决方法

使用 {'Content-Type': 'application/x-www-form-urlencoded'} 解决了我的问题