Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试将 cURL 命令转换为 python,我正在努力
curl -I --user username:password https://an.api.on.the.internet/
我目前的尝试是:
import requests cur = requests.get('https://an.api.on.the.internet', auth='username:password')
谁能帮我转换一下?谢谢
利用
requests.get(url, auth=(username, password))
请参阅文档中有关基本身份验证的部分。requests
requests