mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2025-07-13 17:42:20 +03:00
Fix a typing issue in an example
`ApiClient` expects timeout to be an integer (based on a type hint), but `os.getenv` returns a string when `TIMEOUT` is set.
This commit is contained in:
parent
80cc30523b
commit
fcec83779d
|
@ -68,7 +68,7 @@ Before:
|
|||
|
||||
def __init__(self):
|
||||
self.api_key = os.getenv("API_KEY") # <-- dependency
|
||||
self.timeout = os.getenv("TIMEOUT") # <-- dependency
|
||||
self.timeout = int(os.getenv("TIMEOUT")) # <-- dependency
|
||||
|
||||
|
||||
class Service:
|
||||
|
@ -114,7 +114,7 @@ After:
|
|||
service=Service(
|
||||
api_client=ApiClient(
|
||||
api_key=os.getenv("API_KEY"),
|
||||
timeout=os.getenv("TIMEOUT"),
|
||||
timeout=int(os.getenv("TIMEOUT")),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
@ -137,7 +137,7 @@ Now you need to assemble and inject the objects like this:
|
|||
service=Service(
|
||||
api_client=ApiClient(
|
||||
api_key=os.getenv("API_KEY"),
|
||||
timeout=os.getenv("TIMEOUT"),
|
||||
timeout=int(os.getenv("TIMEOUT")),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user