Skip to content

Commit a50f4d9

Browse files
remove TypedDict for py3.7 compatibility
1 parent 4a293a9 commit a50f4d9

File tree

1 file changed

+8
-13
lines changed

1 file changed

+8
-13
lines changed

testcontainers/minio.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,10 @@
1-
from typing import TypedDict
2-
31
from minio import Minio
42
from requests import ConnectionError, Response, get
53

64
from testcontainers.core.container import DockerContainer
75
from testcontainers.core.waiting_utils import wait_container_is_ready
86

97

10-
class MinioConfig(TypedDict):
11-
endpoint: str
12-
access_key: str
13-
secret_key: str
14-
15-
168
class MinioContainer(DockerContainer):
179
def __init__(
1810
self,
@@ -37,25 +29,28 @@ def get_client(self, **kwargs) -> Minio:
3729
3830
Returns:
3931
Minio: Python Minio Client according to
40-
https://min.io/docs/minio/linux/developers/python/API.html
32+
https://min.io/docs/minio/linux/developers/python/API.html
4133
"""
34+
host_ip = self.get_container_host_ip()
35+
exposed_port = self.get_exposed_port(self.port_to_expose)
4236
return Minio(
43-
f"{self.get_container_host_ip()}:{self.get_exposed_port(self.port_to_expose)}",
37+
f"{host_ip}:{exposed_port}",
4438
access_key=self.access_key,
4539
secret_key=self.secret_key,
4640
secure=False,
4741
**kwargs,
4842
)
4943

50-
def get_config(self) -> MinioConfig:
44+
def get_config(self) -> dict:
5145
"""Returns the configuration of the Minio container.
5246
5347
Returns:
5448
MinioConfig: Dictionary with the endpoint, access_key and secret_key.
5549
"""
50+
host_ip = self.get_container_host_ip()
51+
exposed_port = self.get_exposed_port(self.port_to_expose)
5652
return {
57-
"endpoint": f"{self.get_container_host_ip()}" +
58-
f":{self.get_exposed_port(self.port_to_expose)}",
53+
"endpoint": f"{host_ip}:{exposed_port}",
5954
"access_key": self.access_key,
6055
"secret_key": self.secret_key,
6156
}

0 commit comments

Comments
 (0)