~pythonregexp2.7/python/issue2636

« back to all changes in this revision

Viewing changes to Doc/library/robotparser.rst

  • Committer: Jeffrey C. "The TimeHorse" Jacobs
  • Date: 2008-05-24 16:05:21 UTC
  • mfrom: (39021.1.401 Regexp-2.6)
  • Revision ID: darklord@timehorse.com-20080524160521-1xenj7p6u3wb89et
Merged in changes from the latest python source snapshot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
=============================================
4
4
 
5
5
.. module:: robotparser
6
 
   :synopsis: Loads a robots.txt file and answers questions about fetchability of other URLs.
 
6
   :synopsis: Loads a robots.txt file and answers questions about
 
7
              fetchability of other URLs.
7
8
.. sectionauthor:: Skip Montanaro <skip@pobox.com>
8
9
 
9
10
 
21
22
 
22
23
.. class:: RobotFileParser()
23
24
 
24
 
   This class provides a set of methods to read, parse and answer questions about a
25
 
   single :file:`robots.txt` file.
 
25
   This class provides a set of methods to read, parse and answer questions
 
26
   about a single :file:`robots.txt` file.
26
27
 
27
28
 
28
29
   .. method:: set_url(url)
42
43
 
43
44
   .. method:: can_fetch(useragent, url)
44
45
 
45
 
      Returns ``True`` if the *useragent* is allowed to fetch the *url* according to
46
 
      the rules contained in the parsed :file:`robots.txt` file.
 
46
      Returns ``True`` if the *useragent* is allowed to fetch the *url*
 
47
      according to the rules contained in the parsed :file:`robots.txt`
 
48
      file.
47
49
 
48
50
 
49
51
   .. method:: mtime()
50
52
 
51
 
      Returns the time the ``robots.txt`` file was last fetched.  This is useful for
52
 
      long-running web spiders that need to check for new ``robots.txt`` files
53
 
      periodically.
 
53
      Returns the time the ``robots.txt`` file was last fetched.  This is
 
54
      useful for long-running web spiders that need to check for new
 
55
      ``robots.txt`` files periodically.
54
56
 
55
57
 
56
58
   .. method:: modified()
57
59
 
58
 
      Sets the time the ``robots.txt`` file was last fetched to the current time.
 
60
      Sets the time the ``robots.txt`` file was last fetched to the current
 
61
      time.
59
62
 
60
63
The following example demonstrates basic use of the RobotFileParser class. ::
61
64