0

My url is too long and it throws me the error:

ConnectionError: HTTPConnectionPool(host='xxxx', port=8086): Max retries exceeded with url: /user/profile?nick=nick&name=xxx&city=xxx&gender=x&profile_image=%FF%D8%FF%E0%00%10JFIF%00%01%01%01%00%60%00%60%00%00%...

I am uploading an image to a file iput and trying to pass it by requests.post but it throws me the error above.

My code is this:

profile_image = self.request.get("f_profile_image")
    data = {"id": id_user,
                "nick": nick,
                "name": name,
                "last_name": last_name,
                "gender": gender,
                "profile_image": profile_image}

    d = requests.post("http://myhost:8086/user/profile",params=data)
    self.response.out.write(d.text)

I get the picture here profile_image = self.request.get("f_profile_image") I sent from the form, and try to send it to my server for storage in a database. But d = requests.post("http://myhost:8086/user/profile",params=data) make the mistake I mentioned above

Drako
  • 1
  • 2
  • You might want to show some code on how you're doing this. It looks like you're trying to encode the image and send it in the POST url, which will easily make the URL too long. You want to put the image in the POST data. – dragonx Oct 09 '12 at 18:11
  • When you post data like an image, you have to post it as a multipart message in the payload. See this question: http://stackoverflow.com/questions/10066540/post-request-with-multipart-form-data-in-appengine-python-not-working Looking at your code. You receive an image from a form. Why don't you upload the image to your server? https://developers.google.com/appengine/docs/python/blobstore/overview#Uploading_a_Blob – voscausa Oct 10 '12 at 10:49

1 Answers1

0

hi guys, the error had occurred because it was not introduced well data types in my model, and later on as they understand the error message did not help me much and I'm to believe that the error had it elsewhere thanks for your feedback.

Drako
  • 1
  • 2