Kaydet (Commit) 69af5801 authored tarafından Benjamin Peterson's avatar Benjamin Peterson

update example, since python.org is HTTPS-only now (closes #24118)

üst aa767a55
...@@ -591,13 +591,13 @@ Examples ...@@ -591,13 +591,13 @@ Examples
Here is an example session that uses the ``GET`` method:: Here is an example session that uses the ``GET`` method::
>>> import httplib >>> import httplib
>>> conn = httplib.HTTPConnection("www.python.org") >>> conn = httplib.HTTPSConnection("www.python.org")
>>> conn.request("GET", "/index.html") >>> conn.request("GET", "/")
>>> r1 = conn.getresponse() >>> r1 = conn.getresponse()
>>> print r1.status, r1.reason >>> print r1.status, r1.reason
200 OK 200 OK
>>> data1 = r1.read() >>> data1 = r1.read()
>>> conn.request("GET", "/parrot.spam") >>> conn.request("GET", "/")
>>> r2 = conn.getresponse() >>> r2 = conn.getresponse()
>>> print r2.status, r2.reason >>> print r2.status, r2.reason
404 Not Found 404 Not Found
...@@ -608,8 +608,8 @@ Here is an example session that uses the ``HEAD`` method. Note that the ...@@ -608,8 +608,8 @@ Here is an example session that uses the ``HEAD`` method. Note that the
``HEAD`` method never returns any data. :: ``HEAD`` method never returns any data. ::
>>> import httplib >>> import httplib
>>> conn = httplib.HTTPConnection("www.python.org") >>> conn = httplib.HTTPSConnection("www.python.org")
>>> conn.request("HEAD","/index.html") >>> conn.request("HEAD","/")
>>> res = conn.getresponse() >>> res = conn.getresponse()
>>> print res.status, res.reason >>> print res.status, res.reason
200 OK 200 OK
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment