classification
Title: Document how to forward POST data on redirects
Type: enhancement Stage: needs patch
Components: Documentation Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: beerNuts, crustymonkey, docs@python, eric.araujo, orsenthil
Priority: normal Keywords:

Created on 2012-03-16 20:25 by beerNuts, last changed 2012-03-19 15:31 by crustymonkey.

Messages (3)
msg156080 - (view) Author: beeNuts (beerNuts) Date: 2012-03-16 20:25
Issue #14144, with the title "urllib2 HTTPRedirectHandler not forwarding POST data in redirect" was recently closed with these comments: 

"This could be cookbook recipe style example, if it's utility
value is high. I am closing this issue as I feel that the requirement may not be addressed by a change. If there is patch for HowTo, we can tackle that in another issue. Thank you for contribution."

The decision that documents on this issue were preferable to a patch seems like a fair compromise, especially considering that the RFC is decidedly ambiguous.I was wondering if the HowTo would be forthcoming? 
It seems to me that the value/utility would certainly be high. I'd submit it myself but I'm so new to Python that I don't trust my ability to do it correctly. It's something I would find highly useful, though.
msg156108 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-03-16 23:33
The idea is to add a short example in Doc/howto/urllib2.rst.  Senthil explained how to do things on #14144 (“obtain the redirected URL and then POST to [it]”), and the example should be introduced by a clear warning about security/misbehavior risks (this is why I’m not adding the “easy” keyword to this report).

If you would like to propose a patch, you can find instructions on how to get and edit the source for the docs in the devguide.  You can also write to the beginner-friendly core-mentorship mailing list (link in the devguide or on mail.python.org) to request help or guidance.
msg156346 - (view) Author: Jay Deiman (crustymonkey) Date: 2012-03-19 15:31
I actually just worked around this issue in my library to do specifically what I needed it to do, which was an automatic redirect POST with data.  As far as general recipes are concerned, anyone could just follow what I did in my library at:

https://github.com/crustymonkey/py-sonic or
http://pypi.python.org/pypi/py-sonic

All I did was just subclass HTTPRedirectHandler and essentially add my patch.
History
Date User Action Args
2012-03-19 15:31:33crustymonkeysetmessages: + msg156346
2012-03-16 23:33:26eric.araujosetnosy: + orsenthil, eric.araujo, crustymonkey
title: urllib2 HowTo for overriding post/3xx behavior. -> Document how to forward POST data on redirects
messages: + msg156108

versions: + Python 2.7, Python 3.2
stage: needs patch
2012-03-16 20:25:17beerNutssettype: enhancement
2012-03-16 20:25:01beerNutscreate