Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions Lib/urllib/robotparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

__all__ = ["RobotFileParser"]

req_rate = collections.namedtuple('req_rate', 'requests seconds')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change from "req_rate" to "RequestRate", afterall this is a class.

class RobotFileParser:
""" This class provides a set of methods to read, parse and answer
questions about a single robots.txt file.
Expand Down Expand Up @@ -136,11 +138,7 @@ def parse(self, lines):
# check if all values are sane
if (len(numbers) == 2 and numbers[0].strip().isdigit()
and numbers[1].strip().isdigit()):
req_rate = collections.namedtuple('req_rate',
'requests seconds')
entry.req_rate = req_rate
entry.req_rate.requests = int(numbers[0])
entry.req_rate.seconds = int(numbers[1])
entry.req_rate = req_rate(requests=int(numbers[0]), seconds=int(numbers[1]))
state = 2
if state == 2:
self._add_entry(entry)
Expand Down