yanue commented on issue #5747: URL: https://github.com/apache/doris/issues/5747#issuecomment-2750559231
> `curl --location-trusted -u root -T _data.csv -H "label:20" -H "format:csv_with_names" -H "Expect:100-continue" -H "column_separator:," http://192.168.88.13:8030/api/test_db/test_streamload/_stream_load` > > This curl works in cmd, postman and go app but not works in C#, node, python. The error: [NOT_AUTHORIZED]no valid Basic authorization `使用 Session 保持授权信息(防止重定向时丢失 Authorization)` ``` headers = { "Expect": "100-continue", 'Content-Type': 'text/plain; charset=UTF-8', "merge_type": "APPEND", "format": "csv_with_names", "column_separator": ",", } auth = HTTPBasicAuth(username, password) session = requests.sessions.Session() session.should_strip_auth = lambda old_url, new_url: False # **禁用 requests 的自动去掉 Authorization 头部的功能** # 上传文件 file_path = "test.csv" with open(file_path, "rb") as file: resp = session.request('PUT', url=url, data=file, headers=headers, auth=auth) ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
