Python请求cURL的locationtrusted的等价物

2024-06-17 14:53:33 发布

您现在位置:Python中文网/ 问答频道 /正文

使用cURL,我可以做--location-trusted以允许将name+密码发送到站点可能重定向到的所有主机(http://curl.haxx.se/docs/manpage.html#--location-trusted)。在

我可以用Python对请求库执行类似的操作吗?在


Tags: namehttpdocs站点htmllocationcurl重定向
2条回答

如果你必须使用libcurl(这是合法的!),您需要传递^{}选项。在

虽然doc页面本身没有提到它,但这是libcurl命令行 location-trusted标志的等价物。更多信息请参见the CVE page,他们介绍了 location-trusted。在

requests将自动处理重定向: (http://docs.python-requests.org/en/latest/user/quickstart/#redirection-and-history
所以,这应该是一个很好的开始(如果你还没有经历过): (http://docs.python-requests.org/en/latest/user/authentication/

相关问题 更多 >