我正在尝试从一个http服务器(.EXE
,.PIE
,.BIN
)下载各种扩展名的文件。我正在使用HttpNtlmAuth
,下面是我的代码段
import requests
from requests_ntlm import HttpNtlmAuth
swb_json_url = "http://example.com/swbs/download/124301A17.PIE"
username = "MYDOMAIN\Myuser"
password = "mypass"
def get_response(url, username, password):
session = requests.Session()
session.auth = HttpNtlmAuth(username, password)
response = session.get(url, stream=True)
return response
response = get_response(swb_json_url, username, password)
print(response.status_code)
现在,我得到status_code
中的200
。表示它能够针对URL获得有效的响应。但是我不确定如何下载相同的文件。
If I open the same url in browser the file is getting downloaded
。