This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Different behavior for urllib2 in Python 2.7
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 2.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: orsenthil Nosy List: Diego.Manenti.Martins, eric.smith, orsenthil
Priority: normal Keywords:

Created on 2012-04-20 23:13 by Diego.Manenti.Martins, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg158897 - (view) Author: Diego Manenti Martins (Diego.Manenti.Martins) Date: 2012-04-20 23:13
this code sends data in a different way if using python 2.6 or python 2.7

>>> import urllib2
>>> url = 'http://server.com/post_image?tid=zoV6LJ'
>>> f = open('test.jpg')
>>> data = f.read()
>>> res = urllib2.urlopen(url, data)

I checked it with wireshark and the data is sent in a different way when using python 2.7

The code works for python2.5 and python2.6
msg158899 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2012-04-20 23:43
In what way is it different?

Does it cause a problem, or is it compatible but different?
msg158902 - (view) Author: Diego Manenti Martins (Diego.Manenti.Martins) Date: 2012-04-21 00:56
It stoped to work. It was working when using with python 2.6 and crashed on switching to python 2.7

I expect the same behavior of curl -X POST http://server.com/post_image?tid=zoV6LJ -T test.jpg
msg158938 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2012-04-22 00:06
Could you give the proper POST FORM url which you were trying? I could try it in 2.6 and 2.7 and see if there is any difference. Nothing has changed that such low levels like the POST operations by sending of data.
msg184120 - (view) Author: Senthil Kumaran (orsenthil) * (Python committer) Date: 2013-03-13 23:36
I am okay with closing this. If Diego gets back with more info or specifics of error, we can deal with it.
History
Date User Action Args
2022-04-11 14:57:29adminsetgithub: 58844
2013-03-13 23:36:30orsenthilsetstatus: pending -> closed
messages: + msg184120

assignee: orsenthil
resolution: wont fix
stage: resolved
2013-03-13 23:30:22ezio.melottisetstatus: open -> pending
2012-04-22 00:06:06orsenthilsetnosy: + orsenthil
messages: + msg158938
2012-04-21 00:56:58Diego.Manenti.Martinssetmessages: + msg158902
2012-04-20 23:43:29eric.smithsetnosy: + eric.smith
messages: + msg158899
2012-04-20 23:13:46Diego.Manenti.Martinscreate