Make it possible to recover from HTTP session timeout
sjoerdk opened this issue · comments
- dicomtrolley version: 1.1.1
Description
When a Trolley instance is included in a long running scripts (minutes or hours) and there are long pauses between request, the http session or the login-session might time out. Any new Trolley request will then fail.
This situation could be fixed by catching such exceptions, logging in once more, and trying again. However. The Trolley takes a session object as initialization parameter. It does not have any credentials.
What is the best way to handle such timeouts? Should each script implement its own handling? Is this something that can be handled inside Trolley? Is it OK to have credentials in a long-running object?
A good way would be to implement the requests AuthBase class: https://requests.readthedocs.io/en/latest/user/advanced/?highlight=authbase#custom-authentication