[issue33830] example output error
New submission from Aifu LIU <laf163@gmail.com>: The output of this line: print r2.status, r2.reason should same as: print r1.status, r1.reason from https://docs.python.org/2.7/library/httplib.html
import httplib conn = httplib.HTTPSConnection("www.python.org") conn.request("GET", "/") r1 = conn.getresponse() print r1.status, r1.reason 200 OK data1 = r1.read() conn.request("GET", "/") r2 = conn.getresponse() print r2.status, r2.reason 404 Not Found data2 = r2.read() conn.close()
---------- assignee: docs@python components: Documentation messages: 319290 nosy: Aifu LIU, docs@python priority: normal severity: normal status: open title: example output error versions: Python 2.7 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33830> _______________________________________
Martin Panter <vadmium+py@gmail.com> added the comment: Looks like poor application of a Python 3 patch in Issue 24118. The second request was meant to be for /parrot.spam. ---------- nosy: +benjamin.peterson, martin.panter _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33830> _______________________________________
Change by Pablo Galindo Salgado <pablogsal@gmail.com>: ---------- title: example output error -> Error in the output of one example in the httplib docs _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33830> _______________________________________
Change by Karthikeyan Singaravelan <tir.karthi@gmail.com>: ---------- nosy: +xtreak _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33830> _______________________________________
Karthikeyan Singaravelan <tir.karthi@gmail.com> added the comment: I was making a patch for this and both Python 2.7 and Python 3.6 returned "404 OK" for the example instead of "404 Not Found". I think the end-point is misleading and it's better to use httpbin.org for this. cpython git:(master) ./python Python 3.8.0a0 (heads/master:c151f78, Jun 16 2018, 14:50:28) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information.
import http.client conn = http.client.HTTPSConnection("www.python.org") conn.request("GET", "/") r1 = conn.getresponse() print(r1.status, r1.reason) 200 OK data1 = r1.read() conn.request("GET", "/parrot.spam") r2 = conn.getresponse() print(r2.status, r2.reason) 404 OK data2 = r2.read() conn.close() conn = http.client.HTTPSConnection("httpbin.org") conn.request("GET", "/status/404") r2 = conn.getresponse() print(r2.status, r2.reason) 404 NOT FOUND
➜ ~ python2.7 Python 2.7.14 (default, Mar 12 2018, 13:54:56) [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)] on darwin Type "help", "copyright", "credits" or "license" for more information.
import httplib conn = httplib.HTTPSConnection("www.python.org") conn.request("GET", "/") r1 = conn.getresponse() print r1.status, r1.reason 200 OK data1 = r1.read() conn.request("GET", "/parrot.spam") r2 = conn.getresponse() print r2.status, r2.reason 404 OK
---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33830> _______________________________________
Change by Karthikeyan Singaravelan <tir.karthi@gmail.com>: ---------- keywords: +patch pull_requests: +7386 stage: -> patch review _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33830> _______________________________________
Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment: New changeset f0af4c54e32d963e1ccbac005bcbcab1913e051f by Serhiy Storchaka (Xtreak) in branch 'master': bpo-33830: Fix an example in http.client docs for 404. (GH-7780) https://github.com/python/cpython/commit/f0af4c54e32d963e1ccbac005bcbcab1913... ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33830> _______________________________________
Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment: New changeset f0af4c54e32d963e1ccbac005bcbcab1913e051f by Serhiy Storchaka (Xtreak) in branch 'master': bpo-33830: Fix an example in http.client docs for 404. (GH-7780) https://github.com/python/cpython/commit/f0af4c54e32d963e1ccbac005bcbcab1913... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33830> _______________________________________
Serhiy Storchaka <storchaka+cpython@gmail.com> added the comment: New changeset f0af4c54e32d963e1ccbac005bcbcab1913e051f by Serhiy Storchaka (Xtreak) in branch 'master': bpo-33830: Fix an example in http.client docs for 404. (GH-7780) https://github.com/python/cpython/commit/f0af4c54e32d963e1ccbac005bcbcab1913... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33830> _______________________________________
Change by miss-islington <mariatta.wijaya+miss-islington@gmail.com>: ---------- pull_requests: +10528 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33830> _______________________________________
miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset 26ab036098cc0f9e884ef87894f064268a24da0f by Miss Islington (bot) in branch '3.7': bpo-33830: Fix an example in http.client docs for 404. (GH-7780) https://github.com/python/cpython/commit/26ab036098cc0f9e884ef87894f064268a2... ---------- nosy: +miss-islington _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33830> _______________________________________
miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset 26ab036098cc0f9e884ef87894f064268a24da0f by Miss Islington (bot) in branch '3.7': bpo-33830: Fix an example in http.client docs for 404. (GH-7780) https://github.com/python/cpython/commit/26ab036098cc0f9e884ef87894f064268a2... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33830> _______________________________________
miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset 26ab036098cc0f9e884ef87894f064268a24da0f by Miss Islington (bot) in branch '3.7': bpo-33830: Fix an example in http.client docs for 404. (GH-7780) https://github.com/python/cpython/commit/26ab036098cc0f9e884ef87894f064268a2... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33830> _______________________________________
miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset 26ab036098cc0f9e884ef87894f064268a24da0f by Miss Islington (bot) in branch '3.7': bpo-33830: Fix an example in http.client docs for 404. (GH-7780) https://github.com/python/cpython/commit/26ab036098cc0f9e884ef87894f064268a2... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33830> _______________________________________
miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset 26ab036098cc0f9e884ef87894f064268a24da0f by Miss Islington (bot) in branch '3.7': bpo-33830: Fix an example in http.client docs for 404. (GH-7780) https://github.com/python/cpython/commit/26ab036098cc0f9e884ef87894f064268a2... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33830> _______________________________________
miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset 26ab036098cc0f9e884ef87894f064268a24da0f by Miss Islington (bot) in branch '3.7': bpo-33830: Fix an example in http.client docs for 404. (GH-7780) https://github.com/python/cpython/commit/26ab036098cc0f9e884ef87894f064268a2... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33830> _______________________________________
miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset 26ab036098cc0f9e884ef87894f064268a24da0f by Miss Islington (bot) in branch '3.7': bpo-33830: Fix an example in http.client docs for 404. (GH-7780) https://github.com/python/cpython/commit/26ab036098cc0f9e884ef87894f064268a2... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33830> _______________________________________
miss-islington <mariatta.wijaya+miss-islington@gmail.com> added the comment: New changeset 26ab036098cc0f9e884ef87894f064268a24da0f by Miss Islington (bot) in branch '3.7': bpo-33830: Fix an example in http.client docs for 404. (GH-7780) https://github.com/python/cpython/commit/26ab036098cc0f9e884ef87894f064268a2... ---------- _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33830> _______________________________________
Karthikeyan Singaravelan <tir.karthi@gmail.com> added the comment: Closing this since PRs have been merged. Thanks Aifu LIU for the report. ---------- resolution: -> fixed stage: patch review -> resolved status: open -> closed _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue33830> _______________________________________
participants (6)
-
Aifu LIU
-
Karthikeyan Singaravelan
-
Martin Panter
-
miss-islington
-
Pablo Galindo Salgado
-
Serhiy Storchaka