getlago / lago-python-client

Python wrapper for the Lago Rest API
MIT License
20 stars 10 forks source link

feat: add httpx Timeout optional parameter #190

Closed willymwai closed 1 year ago

willymwai commented 1 year ago

Add httpx timeout to request mixins (create, destroy, find_all, find, update)

Usage:

from httpx import Timeout

client = Client(api_key='__YOUR_API_KEY__')
client.invoices.find_all({'per_page': 2, 'page': 1}, timeout=Timeout(30))

Use case:

Since there is no ability to exclude zero amount invoices when fetching, the number may be large for a particular date range. This causes a ReadTimout exception to occur when the request takes more than 5 seconds which is the default for httpx