Exemplo n.º 1
0
 def process_redirect_body(self, response):
     try:
         return BaseService.process_redirect_body(self, response)
     except UnexpectedNoResult:
         if b'Sajn\xc3\xa1lom, de a be\xc3\xadrt URL hib\xc3\xa1s!'.decode('utf8') in response.text:
             return (URLStatus.not_found, None, None)
         else:
             raise
Exemplo n.º 2
0
 def process_redirect_body(self, response):
     try:
         return BaseService.process_redirect_body(self, response)
     except UnexpectedNoResult:
         if b'Sajn\xc3\xa1lom, de a be\xc3\xadrt URL hib\xc3\xa1s!'.decode(
                 'utf8') in response.text:
             return (URLStatus.not_found, None, None)
         else:
             raise
Exemplo n.º 3
0
    def process_redirect_body(self, response):
        try:
            return BaseService.process_redirect_body(self, response)
        except UnexpectedNoResult:
            if 'cakeErr1-context' not in response.text:
                raise

            match = re.search(r'"Location: (.*)"</pre>', response.text,
                              re.DOTALL)

            if not match:
                raise

            link = match.group(1)
            # Python's urllib escapes too much. We'll escape the bare minimum
            link = link.replace('\n', '%0A')
            link = link.replace('\r', '%0D')

            return (URLStatus.ok, link, response.encoding)
Exemplo n.º 4
0
    def process_redirect_body(self, response):
        try:
            return BaseService.process_redirect_body(self, response)
        except UnexpectedNoResult:
            if 'cakeErr1-context' not in response.text:
                raise

            match = re.search(
                r'"Location: (.*)"</pre>', response.text, re.DOTALL
            )

            if not match:
                raise

            link = match.group(1)
            # Python's urllib escapes too much. We'll escape the bare minimum
            link = link.replace('\n', '%0A')
            link = link.replace('\r', '%0D')

            return (URLStatus.ok, link, response.encoding)
Exemplo n.º 5
0
    def process_redirect_body(self, response):
        if response.status_code == 301 and 'Location' not in response.headers:
            return (URLStatus.not_found, None, None)

        return BaseService.process_redirect_body(self, response)