qtrade icon indicating copy to clipboard operation
qtrade copied to clipboard

Unclosed socket when doing testing with unittest

Open ceprio opened this issue 2 years ago • 2 comments

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,

ceprio avatar Nov 07 '22 17:11 ceprio

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!

jborchma avatar Nov 08 '22 20:11 jborchma

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.

ceprio avatar Nov 09 '22 02:11 ceprio