python - 无法让 Python 补丁请求工作
问题描述
article_url = "https://api.airtable.com/v0/appxxxxxxxxxxx/articles/row_id?api_key=APIKEY"
data = {"fields" : {"contacted" : "hello world"}, "typecast":True}
patch_article_data = requests.patch(article_url, data=data)
我不明白为什么上述方法对补丁请求不起作用。我尝试了很多变体,包括没有类型转换。我得到以下回应。
{u'error': {u'message': u'Invalid request: parameter validation failed. Check your request data.', u'type': u'INVALID_REQUEST_UNKNOWN'}}
解决方案
I think that the problem is linked with the way you are sending the payload, instead of sending it like a string I would recommend you try sending it as a JSON string by replacing:
patch_article_data = requests.patch(article_url, data=data)
with
patch_article_data = requests.patch(article_url, json=data)
推荐阅读
- spring - 有没有办法查看给定配置文件的有效 Spring 属性?
- javascript - 将新数据添加到图表时图表JS闪烁(Vue)
- laravel - 如何在 Laravel Sanctum (SPA) 中进行实时通知 - 私人频道广播?
- drools - Drools KieContainer 返回 null KieSession
- java - 我无法执行 gradle 同步,因为 Android Studio 找不到 Android SDK Platform 29
- r - 如何从 .RData 文件中提取代码并将它们转换为 .R 格式?
- okhttp - Mockwebserver 关闭失败
- json - 断言空手道 API 提供的排序逻辑的最佳方法是什么?我应该使用 Java 还是 Javascript
- python - ValueError: Input 0 is in compatible with layer resnet50: expected shape=(None, 224, 224, 3), found shape=(6, 13)
- c# - 如何在 SkiaSharp 中任意从屏幕上的 SVG 字符串直接绘制 SKPath?