示例#1
0
 def _handle_redirect(self, req, fp, code, msg, headers):
     url_unescaped = headers.get('Location')
     new_url = quote_url(url_unescaped)
     headers.replace_header('Location', new_url)
     result = HTTPRedirectHandler.http_error_302(self, req, fp, code, msg,
                                                 headers)
     return result
 def http_error_302(self, req, fp, code, msg, headers):
     if self.throw:
         self.location = headers.getheader('Location')
         raise RedirectionException()
     else:
         return HTTPRedirectHandler.http_error_302(self, req, fp, code, msg,
                                                   headers)
示例#3
0
 def http_error_302(self, req, fp, code, msg, headers):
     previous_url = req.url
     result = HTTPRedirectHandler.http_error_302(
         self, req, fp, code, msg, headers)
     if not hasattr(result, "redirected_via"):
         result.redirected_via = []
     result.redirected_via.append(previous_url)
示例#4
0
 def http_error_302(self, req, fp, code, msg, headers):
     previous_url = req.url
     result = HTTPRedirectHandler.http_error_302(
         self, req, fp, code, msg, headers)
     if not hasattr(result, "redirected_via"):
         result.redirected_via = []
     result.redirected_via.append(previous_url)
示例#5
0
 def http_error_302(self, req, fp, code, msg, headers):
     #self.log.info("http_error_302: code %s headers %s" % (code, headers))
     if 'location' in headers:
         newurl = headers['location']
         if newurl.startswith('mms:'):
             raise URLError("MMS REDIRECT:" + headers["Location"])
     return HTTPRedirectHandler.http_error_302(self, req, fp, code, msg,
                                               headers)
示例#6
0
    def http_error_302(self, req, res, code, msg, headers):
        '''Filter non-GET request before calling parent implementation.'''

        method = req.get_method()

        # Bail unless method is get
        if method != 'GET':
            return res

        # Let parent handle the rest
        return HTTPRedirectHandler.http_error_302(self, req, res, code, msg,
                                                  headers)
示例#7
0
    def http_error_302(self, request, fp, code, message, headers):
        cookie = SimpleCookie()

        request_cookie = request.headers.get('Cookie')
        if request_cookie:
            cookie.load(request_cookie)

        set_cookie = headers.get('set-cookie')
        if set_cookie:
            for value in set_cookie:
                cookie.load(value)

        headers['Cookie'] = cookie.output(header='', sep='; ')

        redirect_handler = HTTPRedirectHandler.http_error_302(self, request, fp, code, message, headers)
        return inesHTTPError(request, redirect_handler, code, message, headers)
示例#8
0
    def http_error_302(self, req, res, code, msg, headers):
        '''Filter non-GET request before calling parent implementation.'''

        method = req.get_method()

        # Bail unless method is get
        if method != 'GET':
            return res

        # Let parent handle the rest
        return HTTPRedirectHandler.http_error_302(
            self,
            req,
            res,
            code,
            msg,
            headers)
 def http_error_302(self, req, fp, code, msg, headers):
     result = HTTPRedirectHandler.http_error_302(self, req, fp, code, msg, headers)
     result.status = code
     return result
示例#10
0
 def http_error_302(self, req, res, code, msg, hdrs):
     # Let parent handle the rest
     return HTTPRedirectHandler.http_error_302(self, req, res, code, msg,
                                               hdrs)
示例#11
0
文件: _base.py 项目: slibby/ArcREST
 def http_error_302(self, req, fp, code, msg, headers):
     result = HTTPRedirectHandler.http_error_302(self, req, fp, code, msg, headers)
     result.status = code
     return result
示例#12
0
文件: url.py 项目: bunburya/bunbot
 def _handle_redirect(self, req, fp, code, msg, headers):
     url_unescaped = headers.get('Location')
     new_url = quote_url(url_unescaped)
     headers.replace_header('Location', new_url)
     result = HTTPRedirectHandler.http_error_302(self, req, fp, code, msg, headers)
     return result
示例#13
0
文件: rss_scraper.py 项目: uvacw/inca
 def http_error_302(self, req, fp, code, msg, headers):
     return HTTPRedirectHandler.http_error_302(self, req, fp, code, msg,
                                               headers)