I am having a trouble with using the request()
method of Session class in Python.
In my backend, if I call an API with request()
Method first time there is the response. But if I call this method after 5 minutes, it throws:
Connection aborted, Remote disconnected (Remote end closed connection without response)
But if I call the same API with Postman, it always returns response.
Here is my code snippet.
from requests.sessions import Session as _Session
class Session(_Session):
def __request(method, url, json, data, files, params):
try:
response = self.request(headers, method, url, json, data, files, params)
except Exception as e:
print(str(e))
I have checked the headers and it was the same in any cases.
What might be the issue?
I have added timeouts=10
but it was not working.
2