我正在使用Python的请求模块使用imgflip的API“生成一个Meme”,但是在使用boxes
时,我收到以下错误消息:
No texts specified. Remember, API request params are http parameters not JSON.
这是我当前的代码:
boxes = [{"text": top}, {"text": bottom}]
params = {
"template_id": 181913649,
"username": username,
"password": password,
"font": "arial",
"boxes": boxes
}
meme = requests.post(url="https://api.imgflip.com/caption_image", params=params).json()
我已经将boxes
格式化为他们在文档中所说的那样(https://imgflip.com/api)
所以我不知道为什么它不起作用
当前您正在发送类似以下内容:
我认为这应该是application/x-www-form-urlencoded编码的:
因此,您还应该能够使用data(
data=params
)参数相关问题 更多 >
编程相关推荐