网上资料很多,但要找到想要的得找半天
import requests
if __name__ == "__main__":
downloadurl = 'xxxx.xxx'
response = requests.get(url=downloadurl,params={"type":2})
file_name = response.headers.get('Content-Disposition').split(';')[1].split('=')[1].strip('\"')
filepath = os.path.join(r'C:\Users\Administrator\Documents\tmp', file_name)
with open(filepath, "wb") as code:
code.write(response.content)