Closed criverc closed 4 years ago
I like the idea. Thanks
It'd probably be worth having a logout()
method on the session object itself and putting the context manager stuff in the base session class.
WideSky implements a log-out using a REST call (DELETE /oauth2/token
IIRC). Not sure how nHaystack does a log-out.
Absolutely, I'm on it
@sjlongland can you take care of the widesky logout function ? I will test nhaystack
On 12/8/20 10:19 am, Christian Tremblay wrote:
@sjlongland can you take care of the widesky logout function ? I will test nhaystack
I'll try to slot it in somewhere in the TO-DO list.
@criverc I've tested the best I can on my side and things seem to work properly on Skyspark and nhaystack. I'd like you to test the develop branch please. Just to be sure.
@sjlongland Whenever you have time... Feel free to bring your touch to what I did. It's been a long time a digged into pyhaystack...
@ChristianTremblay The move to the base class looks good. I see also that using print was a bad idea. I will test it now and let you know.
@ChristianTremblay Hi, I tried by hand, using my code with changes to use the context manager, pyhaystack is from the head of develop branch and I see that everything works as expected and sessions are closed at skyspark.
@criverc Thanks for the test... and for the idea.
@ChristianTremblay I am glad I could help, thank you for pyhaystack.
Before I forget (since this PR is merged) I've filed myself an issue on my own fork to do this.
Hi, I found the need to use SkysparkScramHaystackSession to get some data from a Skyspark server, but I didn't like that sessions lingered there for 3 hours. So I wrote some code to close the session using an advice given by Brian Frank. I like the use of the with statement in Python so I made changes to SkysparkScramHaystackSession to become a ContextManager. Please consider these changes for upstream.