Closed
Description
Is your feature request related to a problem? Please describe.
When trying to download a file in chunks, I need to be able to specify the Range
header. There is currently no way of specifying any additional headers outside of the call to the provided client's get_headers()
Describe the solution you'd like
There are two ways of going about this, and I feel both have their uses:
- Specify custom headers when creating a
Client
to be used with endpoint functions. This is useful in cases where a header needs to be used/reused frequently. The only downside is this is a bit inconvenient in use cases where the headers aren't used/reused frequently. There could be aset_headers
method or something similar, but the easiest way to handle single-use headers would be: - Add a
headers: Optional[Dict[str, Any]]
param to endpoint functions. This allows headers to be specified on a per-call basis such that using something like theRange
header wouldn't require creating a newClient
(or updating an existing Client's headers) for each call
I think implementing both would be best. It gives the flexibility of per-call headers, while also allowing users to have clients with a pre-set (albeit updatable) set of headers for easy reuse