Skip to content

Specify additional headers #146

@emann

Description

@emann

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:

  1. 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 a set_headers method or something similar, but the easiest way to handle single-use headers would be:
  2. 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 the Range header wouldn't require creating a new Client (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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions