tus-py-client icon indicating copy to clipboard operation
tus-py-client copied to clipboard

Provide a requests session to Uploader

Open peterroelants opened this issue 2 years ago • 3 comments

It would make the library more flexible if the Uploader could be given a requests Session object which it uses to make all requests.

Custom requests sessions can be used for many things. For example, I use them myself to capture all 401 Unauthorized errors when my tokens are expired, make sure I'm re-authenticated and repeat the request. I've seen others use them to fix a URL base or adding custom headers.

Would tus-py-client maintainers be open to providing the ability to initialize an Uploader with a custom requests.Session object to enable use cases like this?

peterroelants avatar Jan 24 '23 11:01 peterroelants

Maybe it is not clear from the initial comment, but I would be willing to spend time myself implementing the feature, if you think it would be a good idea.

peterroelants avatar Jan 26 '23 08:01 peterroelants

Sounds good! It will be great if you could open a PR for this!

Acconut avatar Feb 06 '23 17:02 Acconut

It would be handy if there was a way to provide a custom HTTP stack, like in tus-js-client.

SpecLad avatar Mar 29 '23 22:03 SpecLad