• Facebook
  • Twitter
  • Reddit
  • StumbleUpon
  • Digg
  • email

All Samples(341)  |  Call(107)  |  Derive(22)  |  Import(212)
Raised when HTTP error occurs, but also acts like non-error return

src/d/j/djangorestmodel-HEAD/rest_client/rest_client.py   djangorestmodel(Download)
    def _make_request(self, url, method, payload, headers):
        request = urllib2.Request(self.base_url + url, headers=headers, data=payload)
        request.get_method = lambda: method
        response = self.opener.open(request)
        response_code = getattr(response, 'code', -1)
        if response_code == -1:
            raise urllib2.HTTPError(url, response_code, "Error accessing external resource", None, None)
    def expect(self, response_code):
        "If the actual response code does not match the expected response code, raises a HTTPError"
        if self.response_code != response_code:
            raise urllib2.HTTPError(self.url, self.response_code, "Expected response code: %s, but was %s" % (response_code, self.response_code), None, None)
 
    def __getattr__(self, attr_name):
        if self.headers.has_key(attr_name):

src/n/o/nous.mailpost-0.5/src/nous/mailpost/smtp2zope.py   nous.mailpost(Download)
    def http_error_302(self, req, fp, code, msg, headers):
        raise urllib2.HTTPError(req.get_full_url(), code, msg, headers, fp)
 
# Install the broken redirect handler
opener = urllib2.build_opener(BrokenHTTPRedirectHandler())
urllib2.install_opener(opener)
 

src/z/a/zamboni-lib-HEAD/lib/python/setuptools/package_index.py   zamboni-lib(Download)
    else:
        status, message, body = 404, "Path not found", "Not found"
 
    return urllib2.HTTPError(url, status, message,
            {'content-type':'text/html'}, cStringIO.StringIO(body))
 
 

src/k/e/keeprunning-HEAD/twill/other_packages/_mechanize_dist/_http.py   keeprunning(Download)
 
import copy, time, tempfile, htmlentitydefs, re, logging, socket, \
       urllib2, urllib, httplib, sgmllib
from urllib2 import URLError, HTTPError, BaseHandler
from cStringIO import StringIO
 
from _request import Request
            new._origin_req = getattr(req, "_origin_req", req)
            return new
        else:
            raise HTTPError(req.get_full_url(), code, msg, headers, fp)
 
    def http_error_302(self, req, fp, code, msg, headers):
        # Some servers (incorrectly) return multiple Location headers
            visited = new.redirect_dict = req.redirect_dict
            if (visited.get(newurl, 0) >= self.max_repeats or
                len(visited) >= self.max_redirections):
                raise HTTPError(req.get_full_url(), code,
                                self.inf_msg + msg, headers, fp)
        else:
            visited = new.redirect_dict = req.redirect_dict = {}
    class RobotExclusionError(urllib2.HTTPError):
        def __init__(self, request, *args):
            apply(urllib2.HTTPError.__init__, (self,)+args)
            self.request = request
 
    class HTTPRobotRulesProcessor(BaseHandler):
        # before redirections, after everything else
            response = fp
        else:
            response = urllib2.HTTPError(
                req.get_full_url(), code, msg, hdrs, fp)
        assert code == response.code
        assert msg == response.msg
        assert hdrs == response.hdrs

src/u/r/urlimport-0.86c-dev/urlimport/urlimport.py   urlimport(Download)
from base64 import encodestring
from urlparse import urlsplit, urlunsplit
from httplib import HTTPSConnection
from urllib2 import HTTPDefaultErrorHandler, HTTPSHandler, HTTPError, \
    HTTPRedirectHandler, build_opener, urlopen, Request
 
 
    def http_error_304(self, req, fp, code, msg, headers):
        response = HTTPError(req.get_full_url(), code, msg, headers, fp)
        response.status = code
        return response
 
# use this to open https urls with client certificates.
# taken from http://www.osmonov.com/2009/04/client-certificates-with-urllib2.html

src/b/a/badger-lib-HEAD/packages/setuptools/setuptools/package_index.py   badger-lib(Download)
    else:
        status, message, body = 404, "Path not found", "Not found"
 
    return urllib2.HTTPError(url, status, message,
            {'content-type':'text/html'}, cStringIO.StringIO(body))
 
 

src/l/u/lulupubapi-client-python-HEAD/publish/client/poster/streaminghttp.py   lulupubapi-client-python(Download)
                           origin_req_host=req.get_origin_req_host(),
                           unverifiable=True)
        else:
            raise urllib2.HTTPError(req.get_full_url(), code, msg, headers, fp)
 
class StreamingHTTPHandler(urllib2.HTTPHandler):
    """Subclass of `urllib2.HTTPHandler` that uses

src/r/e/reporter-lib-HEAD/packages/setuptools/setuptools/package_index.py   reporter-lib(Download)
    else:
        status, message, body = 404, "Path not found", "Not found"
 
    return urllib2.HTTPError(url, status, message,
            {'content-type':'text/html'}, cStringIO.StringIO(body))
 
 

src/n/o/nous.mailpost-0.5/src/nous/mailpost/__init__.py   nous.mailpost(Download)
    def http_error_302(self, req, fp, code, msg, headers):
        raise urllib2.HTTPError(req.get_full_url(), code, msg, headers, fp)
 
 
def installBrokenRedirectHandler():
    """Install the broken redirect handler.
 

src/d/i/divvyshot-python-HEAD/poster/streaminghttp.py   divvyshot-python(Download)
                           origin_req_host=req.get_origin_req_host(),
                           unverifiable=True)
        else:
            raise urllib2.HTTPError(req.get_full_url(), code, msg, headers, fp)
 
class StreamingHTTPHandler(urllib2.HTTPHandler):
    """Subclass of `urllib2.HTTPHandler` that uses

  1 | 2 | 3 | 4 | 5 | 6 | 7 | 8  Next