Skip to content

Commit 6fe0acd

Browse files
committed
Address additional Review Comments.
1 parent 320b837 commit 6fe0acd

2 files changed

Lines changed: 3 additions & 4 deletions

File tree

Doc/library/urllib.robotparser.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,5 @@ object with additional user-agent headers populated::
121121
>>> rp.read()
122122
>>> rp.can_fetch("*", "http://www.pythontest.net/")
123123
True
124-
>>> rp.can_fetch("*", "https://www.pythontest.net/no-robots-here/")
124+
>>> rp.can_fetch("*", "http://www.pythontest.net/no-robots-here/")
125125
False

Lib/urllib/robotparser.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,8 @@ def set_url(self, url):
6161
self.url = url
6262

6363
if isinstance(url, urllib.request.Request):
64-
self.host, self.path = urllib.parse.urlsplit(url.full_url)[1:3]
65-
else:
66-
self.host, self.path = urllib.parse.urlsplit(url)[1:3]
64+
url = url.full_url
65+
self.host, self.path = urllib.parse.urlsplit(url)[1:3]
6766

6867
def read(self):
6968
"""Reads the robots.txt URL and feeds it to the parser."""

0 commit comments

Comments
 (0)