

def text_search(self, anchor, byte=False):
    '\n        Search the substring in response body.\n\n        :param anchor: string to search\n        :param byte: if False then `anchor` should be the\n            unicode string, and search will be performed in\n            `response.unicode_body()` else `anchor` should be the byte-string\n            and search will be performed in `response.body`\n\n        If substring is found return True else False.\n        '
    if isinstance(anchor, six.text_type):
        if byte:
            raise GrabMisuseError('The anchor should be bytes string in byte mode')
        else:
            return (anchor in self.unicode_body())
    if (not isinstance(anchor, six.text_type)):
        if byte:
            return (anchor in self.body)
        else:
            raise GrabMisuseError('The anchor should be byte string in non-byte mode')

dataset/ETHPy150Open lorien/grab/grab/document.py TextExtension.text_search/original