Advocate
Advocate copied to clipboard
type hints
Requests itself has types in the typeshed: https://github.com/python/typeshed/tree/6e985ef3de3678676d753a1efbf45fd67095a3b2/stubs/requests/requests
so maybe advocate can piggyback off those somehow, but type hints would be nice for static typing
Agreed, adding type hints would be nice, and easily doable for the Advocate-specific parts of the API. I don't know how it'd work for the more dynamic parts of the API, though, specifically the requests.get()
/ requests.post()
/ ... wrapper functions in api.py
that take **kwargs
. The underlying requests module could be anywhere from version 2.18.4
to current, and the type signatures of its functions may have changed between versions.
For the moment, if you need static typing around uses of advocate
, it might make sense to switch to using a requests.Session()
rather than using advocate
's wrappers. You can session.mount()
advocate
's validating HTTP adapters onto a regular requests.Session()
and it'll behave more or less the same as using advocate.Session()
.
Oh using the session subclass looks great, thank you!