Skip to content

Commit eb7af6f

Browse files
authored
Set HTTP client timeout using FACTURAPI_TIMEOUT environment variable (#121)
1 parent f9f01b5 commit eb7af6f

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

facturapi/http/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from ..version import CLIENT_VERSION
1010

1111
API_HOST = 'www.facturapi.io/v2'
12+
FACTURAPI_TIMEOUT = float(os.getenv('FACTURAPI_TIMEOUT', 10.0))
1213

1314

1415
class Client:
@@ -31,7 +32,7 @@ class Client:
3132
client: httpx.Client
3233

3334
def __init__(self) -> None:
34-
self.client = httpx.Client()
35+
self.client = httpx.Client(timeout=FACTURAPI_TIMEOUT)
3536
self.client.headers.update(
3637
{
3738
'User-Agent': f'facturapi-python/{CLIENT_VERSION}',

facturapi/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
__version__ = '1.0.0'
1+
__version__ = '1.0.1'
22
CLIENT_VERSION = __version__

0 commit comments

Comments
 (0)