Example #1
0
def req_loop():
    with HttpClient('www.jamwt.com', 80) as client:
        heads = HttpHeaders()
        heads.set('Host', 'www.jamwt.com')
        log.info(client.request('GET', '/Py-TOC/', heads))
        log.info(client.request('GET', '/', heads))
    a.halt()
Example #2
0
def req_loop():
    with HttpClient("www.jamwt.com", 80) as client:
        heads = HttpHeaders()
        heads.set("Host", "www.jamwt.com")
        log.info(client.request("GET", "/Py-TOC/", heads))
        log.info(client.request("GET", "/", heads))
    a.halt()
Example #3
0
 def finalize_request(self, req, env):
     code = int(env['diesel.status'].split()[0])
     heads = HttpHeaders()
     for n, v in env['diesel.response_headers']:
         heads.add(n, v)
     body = ''.join(env['diesel.output'])
     if 'Content-Length' not in heads:
         heads.set('Content-Length', len(body))
     
     return http_response(req, code, heads, body)
Example #4
0
File: wsgi.py Project: dowski/aspen
 def finalize_request(self, req):
     code = int(self.status.split()[0])
     heads = HttpHeaders()
     for n, v in self.response_headers:
         heads.add(n, v)
     body = ''.join(self.outbuf)
     if 'Content-Length' not in heads:
         heads.set('Content-Length', len(body))
     
     return http_response(req, code, heads, body)
Example #5
0
    def finalize_request(self, req):
        code = int(self.status.split()[0])
        heads = HttpHeaders()
        for n, v in self.response_headers:
            heads.add(n, v)
        body = ''.join(self.outbuf)
        if 'Content-Length' not in heads:
            heads.set('Content-Length', len(body))

        return http_response(req, code, heads, body)
Example #6
0
    def finalize_request(self, req, env):
        code = int(env['diesel.status'].split()[0])
        heads = HttpHeaders()
        for n, v in env['diesel.response_headers']:
            heads.add(n, v)
        body = ''.join(env['diesel.output'])
        if 'Content-Length' not in heads:
            heads.set('Content-Length', len(body))

        return http_response(req, code, heads, body)
Example #7
0
    def __headers(self):
        headers = HttpHeaders()

        default = {
            "Accept": "application/xml",
            "Authorization": self.__authorization_header(),
            "Content-type": "application/xml",
            "User-Agent": "Braintree Python " + version.Version,
            "X-ApiVersion": Configuration.api_version(),
        }
        for k in default:
            headers.set(k, default[k])
        return headers
Example #8
0
def get_client():
    client = HttpClient(host, 80)
    heads = HttpHeaders()
    heads.set('Host', host)
    return client, heads