https://github.com/python/cpython/commit/996c00384d4a3d1157009f3f6aabe595df5a4170
commit: 996c00384d4a3d1157009f3f6aabe595df5a4170
branch: 3.14
author: Miss Islington (bot) <[email protected]>
committer: zware <[email protected]>
date: 2025-11-12T18:40:20Z
summary:

[3.14] gh-141412: Use reliable target URL for urllib example (GH-141474)

The endpoint used for demonstrating reading URLs is no longer
stable. This change substitutes a target over which we have more
control.
(cherry picked from commit fbcac799518e0cb29fcf5f84ed1fa001010b9073)

Co-authored-by: Bob Kline <[email protected]>

files:
M Doc/tutorial/stdlib.rst

diff --git a/Doc/tutorial/stdlib.rst b/Doc/tutorial/stdlib.rst
index fc98ffaadeed88..163f3bdebd8546 100644
--- a/Doc/tutorial/stdlib.rst
+++ b/Doc/tutorial/stdlib.rst
@@ -183,13 +183,13 @@ protocols. Two of the simplest are :mod:`urllib.request` 
for retrieving data
 from URLs and :mod:`smtplib` for sending mail::
 
    >>> from urllib.request import urlopen
-   >>> with urlopen('http://worldtimeapi.org/api/timezone/etc/UTC.txt') as 
response:
+   >>> with urlopen('https://docs.python.org/3/') as response:
    ...     for line in response:
    ...         line = line.decode()             # Convert bytes to a str
-   ...         if line.startswith('datetime'):
+   ...         if 'updated' in line:
    ...             print(line.rstrip())         # Remove trailing newline
    ...
-   datetime: 2022-01-01T01:36:47.689215+00:00
+         Last updated on Nov 11, 2025 (20:11 UTC).
 
    >>> import smtplib
    >>> server = smtplib.SMTP('localhost')

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to