Skip to content

gh-60055: Allow passing a Request instance for RobotParser URLs#103753

Open
ephphatha wants to merge 4 commits into
python:mainfrom
ephphatha:gh-60055
Open

gh-60055: Allow passing a Request instance for RobotParser URLs#103753
ephphatha wants to merge 4 commits into
python:mainfrom
ephphatha:gh-60055

Conversation

@ephphatha

@ephphatha ephphatha commented Apr 24, 2023

Copy link
Copy Markdown

RobotParser only needs to know the type of the URL param in order to set the undocumented host and path properties, so when calling set_url use the pre-parsed attributes if given a Request object instance. Otherwise the only use of the url is when it is passed to urllib.request.urlopen which accepts either str or Request URLs.

Main driver for this change was to set the User-Agent header so #60055 seemed like the appropriate issue to link.

@ephphatha ephphatha requested a review from berkerpeksag as a code owner April 24, 2023 11:02
@bedevere-bot

Copy link
Copy Markdown

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

@ghost

ghost commented Apr 24, 2023

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 12, 2026
Comment thread Lib/test/test_robotparser.py
@read-the-docs-community

read-the-docs-community Bot commented Jul 4, 2026

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33443069 | 📁 Comparing 35bc72c against main (639a552)

  🔍 Preview build  

2 files changed
± library/urllib.robotparser.html
± whatsnew/changelog.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants