Implement the `with` usage on a network client
Follow up of #210 (closed)
That would be great if we could use a connection with the with
statement as for opening a file.
This would avoid many issues. In particular with tests, and in the code where we have to be handle to close the client session in every exit edge cases, not to get a stacktrace on properly close a session.
Creating a function out of @contextlib.asynccontextmanager
would be very nice.
May be this could be introduced in DuniterPy as a helper.