Boto3 when you don’t use S3
Amazon S3 is a great service to host and access files with a very low cost. In Python, you can use boto3 library to access it and it works pretty well. The package is maintained by Amazon.
Other providers can also offer storage services that are based on the S3 protocol. They can be use as a drop in replacement if you want to escape AWS.
Alas, it’s not clear from boto3 documentation how to use it to reach another
provider. So if you (future me) don't want to lose half an hour of searching,
eventually scanning the source code, here is the “trick”: use endpoint_url
parameter.
custom_s3_client = boto3.client(
"s3",
aws_access_key_id=KEY_ID,
aws_secret_access_key=KEY_SECRET,
endpoint_url="https://" + HOST,
)