PyDocs

Nav

Internet Protocols and Support

RobotFileParser.set_url

  • RobotFileParser.set_url(url)
Sets the URL referring to a robots.txt file.
1 Example
>>> import urllib.robotparser
>>> rp = urllib.robotparser.RobotFileParser()
>>> rp.set_url("http://www.pythontest.net/robots.txt")
>>> rp.read()
>>> rrate = rp.request_rate("*")
>>> rrate.requests
1
>>> rrate.seconds
1
>>> rp.crawl_delay("*")
6
>>> rp.can_fetch("*", "http://www.pythontest.net/")
True
>>> rp.can_fetch("*", "http://www.pythontest.net/no-robots-here/")
False
from the Python docs
See Also
No see-alsos for urllib.robotparser/RobotFileParser.set_url
0 Notes
No notes for RobotFileParser.set_url