我有一个curl请求的例子:
curl -X UNLINK
-H "Authorization: OAuth <>" -H 'Link: <https://some/my/url>; rel="relates"' "https://some/my/url"
我已经将带有参数-X LINK
的curl请求转换为SESSION.patch(...)
:
headers = {
'Content-Type': 'application/json',
'Authorization': 'OAuth %s' % some_token
}
params = (
('notify', 'False'),
)
data = '{"links":[{"relationship":"relates", "key":"some_key", "origin":"some_url"}]}'
r = SESSION.patch('https://some/url, params=params, data=data)
但是我知道如何使用requests
实现-X UNLINK
?
据我所知,requests.Session()
中没有像unlink()
这样的方法,.delete()
是API不允许的
可以使用^{} method 传入自定义动词:
请参阅
requests
文档的高级部分的Custom verbs section像
.get()
、.post()
和.patch()
这样的默认方法都只是.request()
的包装器,显式地设置动词相关问题 更多 >
编程相关推荐