tus / tus-py-client

A Python client for the tus resumable upload protocol
https://tus.io/
MIT License
169 stars 45 forks source link

Custom error handler #86

Closed NoUseFreak closed 11 months ago

NoUseFreak commented 12 months ago

Hi,

I want to upload using short-lived tokens. Some requests may return with a 403 status code.

Is it possible to add a custom error handler that refreshes/re-inject the new token before performing a retry?

Kind regards

Acconut commented 11 months ago

There is currently no such functionality inside tus-py-client. You could disable the retries and whenever an error is thrown, you catch it, generate a new token and then resume the upload. I haven't tested it, but this should allow you to implement what you want.