From 52ecc9cc568fef05fad2b0dd62d55d1e4ca0519c Mon Sep 17 00:00:00 2001 From: Zach Leventer Date: Fri, 24 Apr 2026 07:13:00 -0400 Subject: [PATCH 1/2] Fix dead URLs in urllib documentation Replace dead/broken URLs in urllib documentation: - urllib.request.rst: Replace musi-cal.com (503) with python.org/search for GET example - urllib.request.rst: Replace requestb.in (403) with httpbin.org/post for POST example - urllib.robotparser.rst: Replace robotstxt.org/orig.html with RFC 9309 reference, which is the authoritative IETF standard for robots.txt --- Doc/library/urllib.request.rst | 4 ++-- Doc/library/urllib.robotparser.rst | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index 64e915d042d4a0..6a15a3bc6ebddf 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1386,7 +1386,7 @@ containing parameters:: >>> import urllib.request >>> import urllib.parse >>> params = urllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0}) - >>> url = "http://www.musi-cal.com/cgi-bin/query?%s" % params + >>> url = "https://www.python.org/search?%s" % params >>> with urllib.request.urlopen(url) as f: ... print(f.read().decode('utf-8')) ... @@ -1398,7 +1398,7 @@ from urlencode is encoded to bytes before it is sent to urlopen as data:: >>> import urllib.parse >>> data = urllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0}) >>> data = data.encode('ascii') - >>> with urllib.request.urlopen("http://requestb.in/xrbl82xr", data) as f: + >>> with urllib.request.urlopen("https://httpbin.org/post", data) as f: ... print(f.read().decode('utf-8')) ... diff --git a/Doc/library/urllib.robotparser.rst b/Doc/library/urllib.robotparser.rst index 492c65ae209d92..1fa7fc13baa539 100644 --- a/Doc/library/urllib.robotparser.rst +++ b/Doc/library/urllib.robotparser.rst @@ -18,7 +18,7 @@ This module provides a single class, :class:`RobotFileParser`, which answers questions about whether or not a particular user agent can fetch a URL on the website that published the :file:`robots.txt` file. For more details on the -structure of :file:`robots.txt` files, see http://www.robotstxt.org/orig.html. +structure of :file:`robots.txt` files, see :rfc:`9309`. .. class:: RobotFileParser(url='') From 0c8b0ae61901a2db417ccca1fa8dcfc21e6e923d Mon Sep 17 00:00:00 2001 From: Zach Leventer Date: Sat, 25 Apr 2026 07:29:58 -0400 Subject: [PATCH 2/2] Address review: revert robotparser change, use example.com for URLs Revert the robotparser.rst change (will open a separate PR). Switch urllib.request.rst examples to example.com, which is IANA-reserved for documentation per RFC 2606. --- Doc/library/urllib.request.rst | 4 ++-- Doc/library/urllib.robotparser.rst | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Doc/library/urllib.request.rst b/Doc/library/urllib.request.rst index 6a15a3bc6ebddf..6d3aadf11b2c25 100644 --- a/Doc/library/urllib.request.rst +++ b/Doc/library/urllib.request.rst @@ -1386,7 +1386,7 @@ containing parameters:: >>> import urllib.request >>> import urllib.parse >>> params = urllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0}) - >>> url = "https://www.python.org/search?%s" % params + >>> url = "https://example.com/search?%s" % params >>> with urllib.request.urlopen(url) as f: ... print(f.read().decode('utf-8')) ... @@ -1398,7 +1398,7 @@ from urlencode is encoded to bytes before it is sent to urlopen as data:: >>> import urllib.parse >>> data = urllib.parse.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0}) >>> data = data.encode('ascii') - >>> with urllib.request.urlopen("https://httpbin.org/post", data) as f: + >>> with urllib.request.urlopen("https://example.com/post", data) as f: ... print(f.read().decode('utf-8')) ... diff --git a/Doc/library/urllib.robotparser.rst b/Doc/library/urllib.robotparser.rst index 1fa7fc13baa539..492c65ae209d92 100644 --- a/Doc/library/urllib.robotparser.rst +++ b/Doc/library/urllib.robotparser.rst @@ -18,7 +18,7 @@ This module provides a single class, :class:`RobotFileParser`, which answers questions about whether or not a particular user agent can fetch a URL on the website that published the :file:`robots.txt` file. For more details on the -structure of :file:`robots.txt` files, see :rfc:`9309`. +structure of :file:`robots.txt` files, see http://www.robotstxt.org/orig.html. .. class:: RobotFileParser(url='')