bpo-34335: Use async/await syntax in documentation examples (GH-8674)
(cherry picked from commit d2ac400267
)
Co-authored-by: Mikhail Terekhov <termim@gmail.com>
This commit is contained in:
parent
7bd52a1564
commit
fac49762c5
|
@ -431,8 +431,7 @@ Simple example querying HTTP headers of the URL passed on the command line::
|
|||
import urllib.parse
|
||||
import sys
|
||||
|
||||
@asyncio.coroutine
|
||||
def print_http_headers(url):
|
||||
async def print_http_headers(url):
|
||||
url = urllib.parse.urlsplit(url)
|
||||
if url.scheme == 'https':
|
||||
connect = asyncio.open_connection(url.hostname, 443, ssl=True)
|
||||
|
|
|
@ -392,8 +392,7 @@ function::
|
|||
import asyncio.subprocess
|
||||
import sys
|
||||
|
||||
@asyncio.coroutine
|
||||
def get_date():
|
||||
async def get_date():
|
||||
code = 'import datetime; print(datetime.datetime.now())'
|
||||
|
||||
# Create the subprocess, redirect the standard output into a pipe
|
||||
|
|
Loading…
Reference in New Issue