如何从使用python请求提供文件的python eve端点下载?我不断地犯错误

如何从使用python请求提供文件的python eve端点下载?我不断地犯错误,python,python-requests,eve,Python,Python Requests,Eve,有一个Python Eve安装,它使用端点为文件提供服务 端点看起来像/smartapi/datafiles/5f4deca38cc01b4384f68529 Python Eve安装不是由我维护的 使用curl,我可以使用我的凭据成功下载该文件 curl -u username:password https://thepythoneve.installation/smartapi/datafiles/5f4deca38cc01b4384f68529 --output test.xlsx

有一个Python Eve安装,它使用端点为文件提供服务

端点看起来像
/smartapi/datafiles/5f4deca38cc01b4384f68529

Python Eve安装不是由我维护的

使用curl,我可以使用我的凭据成功下载该文件

curl -u username:password   https://thepythoneve.installation/smartapi/datafiles/5f4deca38cc01b4384f68529 --output test.xlsx
然而,当我尝试使用python请求时,我总是得到401个未经授权的访问

          auth = HTTPBasicAuth(settings.username, settings.password)
          with requests.get(url, auth=auth, stream=True) as response:
                response.raise_for_status()
                with open(file_path, "wb") as out_file:
                    for chunk in response.iter_content(chunk_size=1024 * 1024):  # 1MB chunks
                        out_file.write(chunk)
                logger.info("Download finished successfully")
                return (response, file_path)
我将在
raise\u状态下继续失败


我希望不要使用pycurl。我仍然喜欢使用
请求
我的代码中缺少了什么来完成这项工作?

auth的结构是什么?
我使用的是HTTPBasicAuth
auth的结构是什么?我使用的是HTTPBasicAuth