@@ -615,18 +615,18 @@ Examples
615
615
Here is an example session that uses the ``GET `` method::
616
616
617
617
>>> import http.client
618
- >>> conn = http.client.HTTPConnection ("www.python.org")
619
- >>> conn.request("GET", "/index.html ")
618
+ >>> conn = http.client.HTTPSConnection ("www.python.org")
619
+ >>> conn.request("GET", "/")
620
620
>>> r1 = conn.getresponse()
621
621
>>> print(r1.status, r1.reason)
622
622
200 OK
623
623
>>> data1 = r1.read() # This will return entire content.
624
624
>>> # The following example demonstrates reading data in chunks.
625
- >>> conn.request("GET", "/index.html ")
625
+ >>> conn.request("GET", "/")
626
626
>>> r1 = conn.getresponse()
627
627
>>> while not r1.closed:
628
628
... print(r1.read(200)) # 200 bytes
629
- b'<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN "...
629
+ b'<!doctype html>\n<!--[if "...
630
630
...
631
631
>>> # Example of an invalid request
632
632
>>> conn.request("GET", "/parrot.spam")
@@ -640,8 +640,8 @@ Here is an example session that uses the ``HEAD`` method. Note that the
640
640
``HEAD `` method never returns any data. ::
641
641
642
642
>>> import http.client
643
- >>> conn = http.client.HTTPConnection ("www.python.org")
644
- >>> conn.request("HEAD","/index.html ")
643
+ >>> conn = http.client.HTTPSConnection ("www.python.org")
644
+ >>> conn.request("HEAD", "/ ")
645
645
>>> res = conn.getresponse()
646
646
>>> print(res.status, res.reason)
647
647
200 OK
0 commit comments