I'm using python3 requests library to send simple http post requests. Below is the change which solves my purpose. But after sending 1000+ requests, getting resource busy or device busy error and sometime too many open files. Upon investigation, I see lot of socket file descriptors are left open. On further investigation, I see these socket file descriptors are left open by python3 requests library.
response = requests.post(url, payload, timeout=30)
response.text
I tried passing headers = {'Connection': 'close'}, but still the the sockets are open. Looks like it's an issue with underlying urllib3 library. Is it a known issue? and fixed? if it is fixed, which version has a fix?