qtrade
qtrade copied to clipboard
Unclosed socket when doing testing with unittest
I'm getting the following warning when testing the API: ResourceWarning: unclosed <ssl.SSLSocket fd=1104, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('192.168.5.66', 50373), raddr=('204.89.196.131', 443)>
The reason is that the Questrade class is missing a session closing statement. Please add the following:
class Questrade:
...
def __del__(self):
self.session.close()
Thank you,
Hey! Thank you for opening the issue! Happy to add this, but I am not sure if I'll get to this before the weekend. I'd also be happy to review a PR contribution if you are in a hurry!
No hurry on my side, I just though it was worth mentionning. I implemented the correction on a derived class with my additionnal features. Thank you for this usefull API.