How do you use an HTTP/HTTPS proxy with boto3?

后端 未结 4 2067
北海茫月
北海茫月 2021-01-01 11:58

On the old boto library is was simple enough to use the proxy, proxy_port, proxy_user and proxy_pass paramet

4条回答
  •  一向
    一向 (楼主)
    2021-01-01 12:12

    As of at least version 1.5.79, botocore accepts a proxies argument in the botocore config.

    e.g.

    import boto3
    from botocore.config import Config
    
    boto3.resource('s3', config=Config(proxies={'https': 'foo.bar:3128'}))
    

    boto3 resource https://boto3.readthedocs.io/en/latest/reference/core/session.html#boto3.session.Session.resource

    botocore config https://botocore.readthedocs.io/en/stable/reference/config.html#botocore.config.Config

提交回复
热议问题