I have backported the patch, but it's not enough. Using requests 0.12.1-2[¹]:
127.0.0.1 - - [2013-02-19 04:53:45] "POST /status/303 HTTP/1.1" 303 0 "-" "python-requests/0.12.1" 127.0.0.1 - - [2013-02-19 04:53:45] "GET /redirect/1 HTTP/1.1" 302 215 "-" "python-requests/0.12.1" 127.0.0.1 - - [2013-02-19 04:53:45] "POST /get HTTP/1.1" 405 183 "-" "python-requests/0.12.1" I have only read the code, but I think it's because of this: https://github.com/kennethreitz/requests/blob/v0.12.1/requests/models.py#L260 When r.status_code == 302 (I have patched this) --> method = self.method (which was POST at the beginning). So we really want that strict_mode is off. I can replicate this: https://github.com/kennethreitz/requests/blob/v0.12.1/requests/models.py#L265 also when strict_mode is True, but IMHO duplicate this code is not a good idea: if we want strict_mode == off, it's better we use the default behavior. The strict_mode stuff is only used in requests/models.py: $ grep -r strict_mode requests/ requests/defaults.py::strict_mode: If true, Requests will do its best to follow RFCs (e.g. POST redirects). requests/defaults.py:defaults['strict_mode'] = False requests/models.py: # Do what the browsers do if strict_mode is off... requests/models.py: if (not self.config.get('strict_mode')): Last release doesn't use this strict_mode stuff: https://github.com/kennethreitz/requests/blob/v1.1.0/requests/sessions.py#L111 What do you suggest? Kind regards, [¹] http://anonscm.debian.org/viewvc/python-modules/packages/requests/branches/0.12.1/ -- Daniele Tricoli 'Eriol' http://mornie.org
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ Python-modules-team mailing list Python-modules-team@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/python-modules-team