Skip to content

Commit bb9ad1a

Browse files
committed
Update more docs
1 parent 83ae04a commit bb9ad1a

2 files changed

Lines changed: 83 additions & 60 deletions

File tree

Doc/library/ssl.rst

Lines changed: 67 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -2473,67 +2473,79 @@ Visual inspection shows that the certificate does identify the desired service
24732473
(that is, the HTTPS host ``www.python.org``)::
24742474

24752475
>>> pprint.pprint(cert)
2476-
{'OCSP': ('http://ocsp.digicert.com',),
2477-
'caIssuers': ('http://cacerts.digicert.com/DigiCertSHA2ExtendedValidationServerCA.crt',),
2478-
'crlDistributionPoints': ('http://crl3.digicert.com/sha2-ev-server-g1.crl',
2479-
'http://crl4.digicert.com/sha2-ev-server-g1.crl'),
2480-
'issuer': ((('countryName', 'US'),),
2481-
(('organizationName', 'DigiCert Inc'),),
2482-
(('organizationalUnitName', 'www.digicert.com'),),
2483-
(('commonName', 'DigiCert SHA2 Extended Validation Server CA'),)),
2484-
'notAfter': 'Sep 9 12:00:00 2016 GMT',
2485-
'notBefore': 'Sep 5 00:00:00 2014 GMT',
2486-
'serialNumber': '01BB6F00122B177F36CAB49CEA8B6B26',
2487-
'subject': ((('businessCategory', 'Private Organization'),),
2488-
(('1.3.6.1.4.1.311.60.2.1.3', 'US'),),
2489-
(('1.3.6.1.4.1.311.60.2.1.2', 'Delaware'),),
2490-
(('serialNumber', '3359300'),),
2491-
(('streetAddress', '16 Allen Rd'),),
2492-
(('postalCode', '03894-4801'),),
2493-
(('countryName', 'US'),),
2494-
(('stateOrProvinceName', 'NH'),),
2495-
(('localityName', 'Wolfeboro'),),
2496-
(('organizationName', 'Python Software Foundation'),),
2497-
(('commonName', 'www.python.org'),)),
2498-
'subjectAltName': (('DNS', 'www.python.org'),
2499-
('DNS', 'python.org'),
2500-
('DNS', 'pypi.org'),
2501-
('DNS', 'docs.python.org'),
2502-
('DNS', 'testpypi.org'),
2503-
('DNS', 'bugs.python.org'),
2504-
('DNS', 'wiki.python.org'),
2505-
('DNS', 'hg.python.org'),
2506-
('DNS', 'mail.python.org'),
2507-
('DNS', 'packaging.python.org'),
2508-
('DNS', 'pythonhosted.org'),
2509-
('DNS', 'www.pythonhosted.org'),
2510-
('DNS', 'test.pythonhosted.org'),
2511-
('DNS', 'us.pycon.org'),
2512-
('DNS', 'id.python.org')),
2513-
'version': 3}
2476+
{
2477+
'OCSP': ('http://ocsp.digicert.com',),
2478+
'caIssuers': ('http://cacerts.digicert.com/DigiCertSHA2ExtendedValidationServerCA.crt',),
2479+
'crlDistributionPoints': (
2480+
'http://crl3.digicert.com/sha2-ev-server-g1.crl',
2481+
'http://crl4.digicert.com/sha2-ev-server-g1.crl',
2482+
),
2483+
'issuer': (
2484+
(('countryName', 'US'),),
2485+
(('organizationName', 'DigiCert Inc'),),
2486+
(('organizationalUnitName', 'www.digicert.com'),),
2487+
(('commonName', 'DigiCert SHA2 Extended Validation Server CA'),),
2488+
),
2489+
'notAfter': 'Sep 9 12:00:00 2016 GMT',
2490+
'notBefore': 'Sep 5 00:00:00 2014 GMT',
2491+
'serialNumber': '01BB6F00122B177F36CAB49CEA8B6B26',
2492+
'subject': (
2493+
(('businessCategory', 'Private Organization'),),
2494+
(('1.3.6.1.4.1.311.60.2.1.3', 'US'),),
2495+
(('1.3.6.1.4.1.311.60.2.1.2', 'Delaware'),),
2496+
(('serialNumber', '3359300'),),
2497+
(('streetAddress', '16 Allen Rd'),),
2498+
(('postalCode', '03894-4801'),),
2499+
(('countryName', 'US'),),
2500+
(('stateOrProvinceName', 'NH'),),
2501+
(('localityName', 'Wolfeboro'),),
2502+
(('organizationName', 'Python Software Foundation'),),
2503+
(('commonName', 'www.python.org'),),
2504+
),
2505+
'subjectAltName': (
2506+
('DNS', 'www.python.org'),
2507+
('DNS', 'python.org'),
2508+
('DNS', 'pypi.org'),
2509+
('DNS', 'docs.python.org'),
2510+
('DNS', 'testpypi.org'),
2511+
('DNS', 'bugs.python.org'),
2512+
('DNS', 'wiki.python.org'),
2513+
('DNS', 'hg.python.org'),
2514+
('DNS', 'mail.python.org'),
2515+
('DNS', 'packaging.python.org'),
2516+
('DNS', 'pythonhosted.org'),
2517+
('DNS', 'www.pythonhosted.org'),
2518+
('DNS', 'test.pythonhosted.org'),
2519+
('DNS', 'us.pycon.org'),
2520+
('DNS', 'id.python.org'),
2521+
),
2522+
'version': 3,
2523+
}
25142524

25152525
Now the SSL channel is established and the certificate verified, you can
25162526
proceed to talk with the server::
25172527

25182528
>>> conn.sendall(b"HEAD / HTTP/1.0\r\nHost: linuxfr.org\r\n\r\n")
25192529
>>> pprint.pprint(conn.recv(1024).split(b"\r\n"))
2520-
[b'HTTP/1.1 200 OK',
2521-
b'Date: Sat, 18 Oct 2014 18:27:20 GMT',
2522-
b'Server: nginx',
2523-
b'Content-Type: text/html; charset=utf-8',
2524-
b'X-Frame-Options: SAMEORIGIN',
2525-
b'Content-Length: 45679',
2526-
b'Accept-Ranges: bytes',
2527-
b'Via: 1.1 varnish',
2528-
b'Age: 2188',
2529-
b'X-Served-By: cache-lcy1134-LCY',
2530-
b'X-Cache: HIT',
2531-
b'X-Cache-Hits: 11',
2532-
b'Vary: Cookie',
2533-
b'Strict-Transport-Security: max-age=63072000; includeSubDomains',
2534-
b'Connection: close',
2535-
b'',
2536-
b'']
2530+
[
2531+
b'HTTP/1.1 200 OK',
2532+
b'Date: Sat, 18 Oct 2014 18:27:20 GMT',
2533+
b'Server: nginx',
2534+
b'Content-Type: text/html; charset=utf-8',
2535+
b'X-Frame-Options: SAMEORIGIN',
2536+
b'Content-Length: 45679',
2537+
b'Accept-Ranges: bytes',
2538+
b'Via: 1.1 varnish',
2539+
b'Age: 2188',
2540+
b'X-Served-By: cache-lcy1134-LCY',
2541+
b'X-Cache: HIT',
2542+
b'X-Cache-Hits: 11',
2543+
b'Vary: Cookie',
2544+
b'Strict-Transport-Security: max-age=63072000; includeSubDomains',
2545+
b'Connection: close',
2546+
b'',
2547+
b'',
2548+
]
25372549

25382550
See the discussion of :ref:`ssl-security` below.
25392551

Doc/tutorial/stdlib2.rst

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,22 @@ and indentation to more clearly reveal data structure::
3030
... 'yellow'], 'blue']]]
3131
...
3232
>>> pprint.pprint(t, width=30)
33-
[[[['black', 'cyan'],
34-
'white',
35-
['green', 'red']],
36-
[['magenta', 'yellow'],
37-
'blue']]]
33+
[
34+
[
35+
[
36+
['black', 'cyan'],
37+
'white',
38+
['green', 'red'],
39+
],
40+
[
41+
[
42+
'magenta',
43+
'yellow',
44+
],
45+
'blue',
46+
],
47+
],
48+
]
3849

3950
The :mod:`textwrap` module formats paragraphs of text to fit a given screen
4051
width::

0 commit comments

Comments
 (0)