def _has_app(self, app, webpage):
        """
        Determine whether the web page matches the app signature.
        """
        # Search the easiest things first and save the full-text search of the
        # HTML for last

        for regex in app['url']:
            if regex.search(webpage.url):
                return True

        for name, regex in app['headers'].items():
            if name in webpage.headers:
                content = webpage.headers[name]
                if regex.search(content):
                    return True

        for regex in app['script']:
            for script in webpage.scripts:
                if regex.search(script):
                    return True

        for name, regex in app['meta'].items():
            if name in webpage.meta:
                content = webpage.meta[name]
                if regex.search(content):
                    return True

        for regex in app['html']:
            if regex.search(webpage.html):
                return True
def _has_app ( self , app , webpage ) : for regex in app [ 'url' ] : if regex . search ( webpage . url ) : return True for name , regex in app [ 'headers' ] . items ( ) : if name in webpage . headers : content = webpage . headers [ name ] if regex . search ( content ) : return True for regex in app [ 'script' ] : for script in webpage . scripts : if regex . search ( script ) : return True for name , regex in app [ 'meta' ] . items ( ) : if name in webpage . meta : content = webpage . meta [ name ] if regex . search ( content ) : return True for regex in app [ 'html' ] : if regex . search ( webpage . html ) : return True
Determine whether the web page matches the app signature.