更新时间:2022-03-13 09:51:11
你的 curl 命令就像代码.当您不知道它支持什么时,您可以curl --help
或使用curl ... --trace-ascii 1.txt
来找出过程.
Your curl command is like code. When you do not know what it supports, you can curl --help
or use curl ... --trace-ascii 1.txt
to figure out the process.
from requests.auth import HTTPBasicAuth
import requests
url = 'https://api_url'
headers = {'Accept': 'application/json'}
auth = HTTPBasicAuth('apikey', '1234abcd')
files = {'file': open('filename', 'rb')}
req = requests.get(url, headers=headers, auth=auth, files=files)