Logo Search packages:      
Sourcecode: webcheck version File versions  Download package

def crawler::Link::follow_link (   self,
  visited = set() 
)

If this link represents a redirect return the redirect target,
otherwise return self. If this redirect does not find a referenced
link None is returned.

Definition at line 540 of file crawler.py.

00540                                         :
        """If this link represents a redirect return the redirect target,
        otherwise return self. If this redirect does not find a referenced
        link None is returned."""
        # if this is not a redirect just return
        if self.redirectdepth == 0:
            return self
        # if we don't know where this redirects, return None
        if len(self.children) == 0:
            return None
        # the first (and only) child is the redirect target
        visited.add(self)
        # check for loops
        child = self.children.copy().pop()
        if child in visited:
            return None
        # check where we redirect to
        return child.follow_link(visited)

    def _pagechildren(self):


Generated by  Doxygen 1.6.0   Back to index