update with s3 endpoint

This commit is contained in:
Nolan Burfield 2025-06-11 23:31:49 -07:00
parent b846a0d7a7
commit 8c17413af1
2 changed files with 9 additions and 5 deletions

View File

@ -17,7 +17,7 @@ class S3Storage:
S3Storage class
"""
def __init__( self, access_key=None, secret_access_key=None, data_center="us-lax-1" ):
def __init__( self, access_key=None, secret_access_key=None, data_center="us-lax-1", endpoint=None ):
"""
__init__ Init S3 Storage class.
@ -29,6 +29,10 @@ class S3Storage:
self.access_key = access_key
self.secret_access_key = secret_access_key
self.data_center = data_center
self.endpoint = endpoint
if endpoint is None:
self.endpoint = f"https://{data_center}.linodeobjects.com"
self.client = None
@ -46,7 +50,7 @@ class S3Storage:
linode_obj_config = {
"aws_access_key_id": self.access_key,
"aws_secret_access_key": self.secret_access_key,
"endpoint_url": f"https://{self.data_center}.linodeobjects.com",
"endpoint_url": self.endpoint,
}
self.client = boto3.client("s3", **linode_obj_config)

View File

@ -9,7 +9,7 @@ with open('README.md', 'r') as f:
setup(
name='lib_afr_s3storage',
version='1.0.2',
version='2.0.0',
author='',
author_email='',
description='',
@ -20,7 +20,7 @@ setup(
packages=find_packages(),
python_requires='>=3.7',
install_requires=[
'boto3==1.33.6',
'smart-open==6.4.0',
'boto3==1.38.35',
'smart-open==7.1.0',
],
)