I have checked, socket.error:[errno 99] cannot assign requested address and namespace in python
Repeated POST request is causing error "socket.error: (99, 'Cannot assign requested address')"
requests, cannot assign requested address, out of ports?
but none of the questions gives an expected answer in case my problem. I have the following code snippet:
with requests.Session() as session:
js_response = session.get(url).json()
- Note: I tried with urllib2, and simply using request.get() as well ! I am trying to query the url repeatedly, and expect a JSON object each time. But, after some requests are done, I start getting the Error 99 (marked below). This is not a continuous process. The errors keep coming intermittently. I understand that the error occurs because I am running out of the requesting ports, and Linux kernel is not able to allocate more ports for the outgoing requests, and thus throws an error.
Error:
('Connection aborted.', error(99, 'Cannot assign requested address'))
Could anyone kindly suggest me a way in Python, which will help me to request the URL repeatedly, without getting the aforementioned error.