@@ -46,9 +46,15 @@ def s3_store(
4646 allow_http : bool = False ,
4747 anonymous : bool = False ,
4848 s3_compatible : bool = False ,
49+ force_path_style : bool = False ,
4950) -> ObjectStoreConfig .S3Compatible | ObjectStoreConfig .S3 :
5051 """Build an ObjectStoreConfig instance for S3 or S3 compatible object stores."""
51- options = S3Options (region = region , endpoint_url = endpoint_url , allow_http = allow_http )
52+ options = S3Options (
53+ region = region ,
54+ endpoint_url = endpoint_url ,
55+ allow_http = allow_http ,
56+ force_path_style = force_path_style ,
57+ )
5258 return (
5359 ObjectStoreConfig .S3Compatible (options )
5460 if s3_compatible
@@ -70,6 +76,7 @@ def s3_storage(
7076 anonymous : bool | None = None ,
7177 from_env : bool | None = None ,
7278 get_credentials : Callable [[], S3StaticCredentials ] | None = None ,
79+ force_path_style : bool = False ,
7380) -> Storage :
7481 """Create a Storage instance that saves data in S3 or S3 compatible object stores.
7582
@@ -99,6 +106,8 @@ def s3_storage(
99106 Fetch credentials from the operative system environment
100107 get_credentials: Callable[[], S3StaticCredentials] | None
101108 Use this function to get and refresh object store credentials
109+ force_path_style: bool
110+ Whether to force using path-style addressing for buckets
102111 """
103112
104113 credentials = s3_credentials (
@@ -110,7 +119,12 @@ def s3_storage(
110119 from_env = from_env ,
111120 get_credentials = get_credentials ,
112121 )
113- options = S3Options (region = region , endpoint_url = endpoint_url , allow_http = allow_http )
122+ options = S3Options (
123+ region = region ,
124+ endpoint_url = endpoint_url ,
125+ allow_http = allow_http ,
126+ force_path_style = force_path_style ,
127+ )
114128 return Storage .new_s3 (
115129 config = options ,
116130 bucket = bucket ,
@@ -132,6 +146,7 @@ def s3_object_store_storage(
132146 expires_after : datetime | None = None ,
133147 anonymous : bool | None = None ,
134148 from_env : bool | None = None ,
149+ force_path_style : bool = False ,
135150) -> Storage :
136151 credentials = s3_credentials (
137152 access_key_id = access_key_id ,
@@ -142,7 +157,12 @@ def s3_object_store_storage(
142157 from_env = from_env ,
143158 get_credentials = None ,
144159 )
145- options = S3Options (region = region , endpoint_url = endpoint_url , allow_http = allow_http )
160+ options = S3Options (
161+ region = region ,
162+ endpoint_url = endpoint_url ,
163+ allow_http = allow_http ,
164+ force_path_style = force_path_style ,
165+ )
146166 return Storage .new_s3_object_store (
147167 config = options ,
148168 bucket = bucket ,
0 commit comments