[Patches] [ python-Patches-1014237 ] RobotFileParser.can_fetch
return value
SourceForge.net
noreply at sourceforge.net
Mon Aug 23 22:44:14 CEST 2004
Patches item #1014237, was opened at 2004-08-23 12:13
Message generated for change (Comment added) made by loewis
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1014237&group_id=5470
Category: Library (Lib)
Group: Python 2.3
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: George Yoshida (quiver)
Assigned to: Nobody/Anonymous (nobody)
Summary: RobotFileParser.can_fetch return value
Initial Comment:
Currently, RobotFileParser.can_fetch method returns two
kinds of types(int and bool) and is not consistent.
More strictly, if a web site sets a robots.txt file, it
returns 1/0. Otherwise, it returns boolean(True/False).
My change is to make can_fetch method return bool
values in either case as documented in robotparser
module.
# examples of can_fetch return values
>>> import robotparser
>>> rp = robotparser.RobotFileParser()
>>> rp.set_url('http://www.ruby-lang.org/robots.txt')
>>> rp.read()
>>> rp.can_fetch('*', 'http://www.ruby-lang.org/')
1
>>> rp.can_fetch('*', 'http://www.ruby-lang.org/doc/')
0
>>> rp.set_url('http://www.example.com/robots.txt')
>>> rp.read()
>>> rp.can_fetch('*', 'http://www.example.com/')
True
----------------------------------------------------------------------
>Comment By: Martin v. Löwis (loewis)
Date: 2004-08-23 22:44
Message:
Logged In: YES
user_id=21627
Thanks for the patch. Committed as robotparser.py 1.20. As
this patch is a slight interface change, I think it is not
appropriate for 2.3: 2.3 applications should be easily
enough capable of working around this problem, and the
change may actually break applications who really care about
the type of the return value.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1014237&group_id=5470
More information about the Patches
mailing list