@@ -125,7 +125,8 @@ Context creation
125125A convenience function helps create :class: `SSLContext ` objects for common
126126purposes.
127127
128- .. function :: create_default_context(purpose=Purpose.SERVER_AUTH, cafile=None, capath=None, cadata=None)
128+ .. function :: create_default_context(purpose=Purpose.SERVER_AUTH, *,\
129+ cafile=None, capath=None, cadata=None)
129130
130131 Return a new :class: `SSLContext ` object with default settings for
131132 the given *purpose *. The settings are chosen by the :mod: `ssl ` module,
@@ -333,7 +334,7 @@ Exceptions
333334Random generation
334335^^^^^^^^^^^^^^^^^
335336
336- .. function :: RAND_bytes(num)
337+ .. function :: RAND_bytes(num, / )
337338
338339 Return *num * cryptographically strong pseudo-random bytes. Raises an
339340 :class: `SSLError ` if the PRNG has not been seeded with enough data or if the
@@ -357,7 +358,7 @@ Random generation
357358 :func: `ssl.RAND_egd ` and :func: `ssl.RAND_add ` to increase the randomness of
358359 the pseudo-random number generator.
359360
360- .. function :: RAND_add(bytes, entropy)
361+ .. function :: RAND_add(bytes, entropy, / )
361362
362363 Mix the given *bytes * into the SSL pseudo-random number generator. The
363364 parameter *entropy * (a float) is a lower bound on the entropy contained in
@@ -425,12 +426,12 @@ Certificate handling
425426 .. versionchanged :: 3.10
426427 The *timeout * parameter was added.
427428
428- .. function :: DER_cert_to_PEM_cert(DER_cert_bytes )
429+ .. function :: DER_cert_to_PEM_cert(der_cert_bytes )
429430
430431 Given a certificate as a DER-encoded blob of bytes, returns a PEM-encoded
431432 string version of the same certificate.
432433
433- .. function :: PEM_cert_to_DER_cert(PEM_cert_string )
434+ .. function :: PEM_cert_to_DER_cert(pem_cert_string )
434435
435436 Given a certificate as an ASCII PEM string, returns a DER-encoded sequence of
436437 bytes for that same certificate.
@@ -1160,10 +1161,10 @@ SSL sockets also have the following additional methods and attributes:
11601161 .. deprecated :: 3.6
11611162 Use :meth: `~SSLSocket.recv ` instead of :meth: `~SSLSocket.read `.
11621163
1163- .. method :: SSLSocket.write(buf )
1164+ .. method :: SSLSocket.write(data )
11641165
1165- Write *buf * to the SSL socket and return the number of bytes written. The
1166- *buf * argument must be an object supporting the buffer interface.
1166+ Write *data * to the SSL socket and return the number of bytes written. The
1167+ *data * argument must be an object supporting the buffer interface.
11671168
11681169 Raise :exc: `SSLWantReadError ` or :exc: `SSLWantWriteError ` if the socket is
11691170 :ref: `non-blocking <ssl-nonblocking >` and the write would block.
@@ -1173,7 +1174,7 @@ SSL sockets also have the following additional methods and attributes:
11731174
11741175 .. versionchanged :: 3.5
11751176 The socket timeout is no longer reset each time bytes are received or sent.
1176- The socket timeout is now the maximum total duration to write *buf *.
1177+ The socket timeout is now the maximum total duration to write *data *.
11771178
11781179 .. deprecated :: 3.6
11791180 Use :meth: `~SSLSocket.send ` instead of :meth: `~SSLSocket.write `.
@@ -1190,10 +1191,13 @@ SSL sockets also have the following additional methods and attributes:
11901191 :meth: `~socket.socket.recv ` and :meth: `~socket.socket.send ` instead of these
11911192 methods.
11921193
1193- .. method :: SSLSocket.do_handshake()
1194+ .. method :: SSLSocket.do_handshake(block=False )
11941195
11951196 Perform the SSL setup handshake.
11961197
1198+ If *block * is true and the timeout obtained by :meth: `~socket.gettimeout `
1199+ is zero, the socket is set in blocking mode until the handshake is performed.
1200+
11971201 .. versionchanged :: 3.4
11981202 The handshake method also performs :func: `match_hostname ` when the
11991203 :attr: `~SSLContext.check_hostname ` attribute of the socket's
@@ -1717,7 +1721,7 @@ to speed up repeated connections from the same clients.
17171721 provided as part of the operating system, though, it is likely to be
17181722 configured properly.
17191723
1720- .. method :: SSLContext.set_ciphers(ciphers)
1724+ .. method :: SSLContext.set_ciphers(ciphers, / )
17211725
17221726 Set the allowed ciphers for sockets created with this context when
17231727 connecting using TLS 1.2 and earlier. The *ciphers * argument should
@@ -1733,7 +1737,7 @@ to speed up repeated connections from the same clients.
17331737 When connected, the :meth: `SSLSocket.cipher ` method of SSL sockets will
17341738 return details about the negotiated cipher.
17351739
1736- .. method :: SSLContext.set_ciphersuites(ciphersuites)
1740+ .. method :: SSLContext.set_ciphersuites(ciphersuites, / )
17371741
17381742 Set the allowed ciphers for sockets created with this context when
17391743 connecting using TLS 1.3. The *ciphersuites * argument should be a
@@ -1747,7 +1751,7 @@ to speed up repeated connections from the same clients.
17471751
17481752 .. versionadded :: next
17491753
1750- .. method :: SSLContext.set_groups(groups)
1754+ .. method :: SSLContext.set_groups(groups, / )
17511755
17521756 Set the groups allowed for key agreement for sockets created with this
17531757 context. It should be a string in the `OpenSSL group list format
@@ -1760,7 +1764,7 @@ to speed up repeated connections from the same clients.
17601764
17611765 .. versionadded :: next
17621766
1763- .. method :: SSLContext.set_client_sigalgs(sigalgs)
1767+ .. method :: SSLContext.set_client_sigalgs(sigalgs, / )
17641768
17651769 Set the signature algorithms allowed for certificate-based client
17661770 authentication. It should be a string in the `OpenSSL client sigalgs
@@ -1775,7 +1779,7 @@ to speed up repeated connections from the same clients.
17751779
17761780 .. versionadded :: next
17771781
1778- .. method :: SSLContext.set_server_sigalgs(sigalgs)
1782+ .. method :: SSLContext.set_server_sigalgs(sigalgs, / )
17791783
17801784 Set the signature algorithms allowed for the server to complete the TLS
17811785 handshake. It should be a string in the `OpenSSL sigalgs list format
@@ -1789,7 +1793,7 @@ to speed up repeated connections from the same clients.
17891793
17901794 .. versionadded :: next
17911795
1792- .. method :: SSLContext.set_alpn_protocols(protocols )
1796+ .. method :: SSLContext.set_alpn_protocols(alpn_protocols )
17931797
17941798 Specify which protocols the socket should advertise during the SSL/TLS
17951799 handshake. It should be a list of ASCII strings, like ``['http/1.1',
@@ -1803,7 +1807,7 @@ to speed up repeated connections from the same clients.
18031807
18041808 .. versionadded :: 3.5
18051809
1806- .. method :: SSLContext.set_npn_protocols(protocols )
1810+ .. method :: SSLContext.set_npn_protocols(npn_protocols )
18071811
18081812 Specify which protocols the socket should advertise during the SSL/TLS
18091813 handshake. It should be a list of strings, like ``['http/1.1', 'spdy/2'] ``,
@@ -1870,7 +1874,7 @@ to speed up repeated connections from the same clients.
18701874
18711875 .. versionadded :: 3.7
18721876
1873- .. attribute :: SSLContext.set_servername_callback(server_name_callback)
1877+ .. method :: SSLContext.set_servername_callback(server_name_callback)
18741878
18751879 This is a legacy API retained for backwards compatibility. When possible,
18761880 you should use :attr: `sni_callback ` instead. The given *server_name_callback *
@@ -1884,7 +1888,7 @@ to speed up repeated connections from the same clients.
18841888
18851889 .. versionadded :: 3.4
18861890
1887- .. method :: SSLContext.load_dh_params(dhfile)
1891+ .. method :: SSLContext.load_dh_params(dhfile, / )
18881892
18891893 Load the key generation parameters for Diffie-Hellman (DH) key exchange.
18901894 Using DH key exchange improves forward secrecy at the expense of
@@ -1897,7 +1901,7 @@ to speed up repeated connections from the same clients.
18971901
18981902 .. versionadded :: 3.3
18991903
1900- .. method :: SSLContext.set_ecdh_curve(curve_name)
1904+ .. method :: SSLContext.set_ecdh_curve(curve_name, / )
19011905
19021906 Set the curve name for Elliptic Curve-based Diffie-Hellman (ECDH) key
19031907 exchange. ECDH is significantly faster than regular DH while arguably
@@ -2771,12 +2775,12 @@ purpose. It wraps an OpenSSL memory BIO (Basic IO) object:
27712775 A boolean indicating whether the memory BIO is current at the end-of-file
27722776 position.
27732777
2774- .. method :: MemoryBIO.read(n=-1)
2778+ .. method :: MemoryBIO.read(n=-1, / )
27752779
27762780 Read up to *n * bytes from the memory buffer. If *n * is not specified or
27772781 negative, all bytes are returned.
27782782
2779- .. method :: MemoryBIO.write(buf)
2783+ .. method :: MemoryBIO.write(buf, / )
27802784
27812785 Write the bytes from *buf * to the memory BIO. The *buf * argument must be an
27822786 object supporting the buffer protocol.
0 commit comments