如何通过socks代理访问Azure blob存储?

2024-09-26 22:50:31 发布

您现在位置:Python中文网/ 问答频道 /正文

在Python中,我需要访问Azure blob存储,但需要通过Socks代理(ssh DynamicForward)

通常,我会这样做:

client = azure.storage.blob.BlobServiceClient(url, credentials)

如何使此客户端使用代理


Tags: clienturl客户端代理storageazuresshblob
1条回答
网友
1楼 · 发布于 2024-09-26 22:50:31

Azure API使用requests进行HTTPS访问。 您可以将请求会话设置为使用socks,如下所示:

import requests
session = requests.Session()
session.proxies["https"] = "socks5h://127.0.0.1:9876"
client = azure.storage.blob.BlobServiceClient(url, credentials, session=session)

相关问题 更多 >

    热门问题