How to get python package `awswranger` to accept a custom `endpoint_url`

Viewed 849

I'm attempting to use the python package awswrangler to access a non-AWS S3 service.

The AWS Data Wranger docs state that you need to create a boto3.Session() object.

The problem is that the boto3.client() supports setting the endpoint_url, but boto3.Session() does not (docs here).

In my previous uses of boto3 I've always used the client for this reason.

Is there a way to create a boto3.Session() with a custom endpoint_url or otherwise configure awswrangler to accept the custom endpoint?

3 Answers

Once you create your session, you can use client as well. For example:

import boto3

session = boto3.Session()
s3 = session.client('s3', endpoint_url='<custom-endpoint>')

I finally found the configuration for awswrangler:

import awswrangler as wr

wr.config.s3_endpoint_url = 'https://custom.endpoint'
Related