msabramo / requests-unixsocket

Use requests to talk HTTP via a UNIX domain socket
Apache License 2.0
207 stars 29 forks source link

ResourceWarning: unclosed socket #36

Closed come-maiz closed 2 years ago

come-maiz commented 7 years ago

Hello!

I'm getting a warning about the socket being unclosed. I'm using requests_unixsocket.Session() in a context manager, so I was expecting it to be closed for me.

To reproduce:

$ python3
>>> import requests_unixsocket
>>> import warnings
>>> warnings.simplefilter('default')
>>> with requests_unixsocket.Session() as session:
...    snap_info = session.get('http+unix://%2Frun%2Fsnapd.socket/v2/snaps/core')
... 
__main__:2: ResourceWarning: unclosed <socket.socket fd=4, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0, raddr=/run/snapd.socket>
$ lsb_release -d
Description:    Ubuntu 16.04.3 LTS
$ python3 --version
Python 3.5.2
$ pip list | grep requests-unixsocket
requests-unixsocket (0.1.5)
msabramo commented 5 years ago

I believe this was fixed by https://github.com/msabramo/requests-unixsocket/pull/28.

Try upgrading to the newly released 0.2.0 and see if that resolves this issue.

msabramo commented 2 years ago

Closing due to inactivity