0

I am running two services on my local machine. I want to send data from service 1 to service 2 which is on port 8004. I am doing the following:

r = requests.get('http://127.0.0.1:8004/json_data='+json.dumps(json_data))

I get these 2 errors:

ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

ConnectionError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))

I assume that I am sending a large file which is causing the problem. My file is 15mb in size, its a python dictionary which I am sending via a json.dumps()

Any recommendation for overcoming this error ?

1 Answer 1

1

HTTP GET requests have a limit when it comes to the request size. There is no standard, but I think the max with the most supportive browser is around 200 KB, which is way below what you are trying to send. An alternative could have been to use POST, but that also has limits around 2MB, which varies from browser to browser and from server to server. So you have two options :

  • Try a file upload.
  • Break down your payload.

Hope this helps.

Sign up to request clarification or add additional context in comments.

4 Comments

Thanks for the answer, what do you mean when you say file upload ?
@AnarKi, what server are you using ?
I am using cherrypy to expose functions
@AnarKi, not very familiar with that, but see if you can use this python example : gist.github.com/UniIsland/3346170

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.