From fcec83779d19c9e4f42fbb3041855c5bf7c2b65c Mon Sep 17 00:00:00 2001 From: Illia Volochii Date: Sat, 9 Apr 2022 16:20:40 +0300 Subject: [PATCH] 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. --- docs/introduction/di_in_python.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/introduction/di_in_python.rst b/docs/introduction/di_in_python.rst index 53fa3a2b..e7076bc2 100644 --- a/docs/introduction/di_in_python.rst +++ b/docs/introduction/di_in_python.rst @@ -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")), ), ), )