Esempio n. 1
0
 def get_headers(self):
     headers = CaseInsensitiveDict()
     for k in ("Cache-Control", "X-TTL"):
         headers[k] = 'max-age={0}'.format(self.cache_control)
     if self.content_encoding is not None:
         headers['Content-Encoding'] = self.content_encoding
     return headers
Esempio n. 2
0
 def get_headers(self):
     headers = CaseInsensitiveDict()
     headers['Cache-Control'] = 'max-age={0}'.format(self.cache_control)
     if self.content_encoding is not None:
         headers['Content-Encoding'] = self.content_encoding
     headers.update(self.extra_headers)
     return headers
Esempio n. 3
0
def getURLHeaders(url):
    url = urllib.parse.urlparse(url)

    conn = http_client.HTTPConnection(url.netloc)
    conn.request('HEAD', urllib.parse.quote(url.path))

    response = conn.getresponse()

    return CaseInsensitiveDict(response.getheaders())
Esempio n. 4
0
    def __init__(self, status, reason=None, headers=None, body=''):
        if reason is None:
            reason = http_client.responses[status]
        if headers is None:
            headers = {}

        self.status = status
        self.reason = reason
        self.headers = CaseInsensitiveDict(headers)
        self.body = body
Esempio n. 5
0
    def __init__(self, connection, method, url, body, headers):
        self.connection = connection

        self.method = method
        self.url = url
        self.body = body
        self.headers = CaseInsensitiveDict(headers)

        u = urllib.parse.urlparse(url)
        self.path = u.path
        self.params = urllib.parse.parse_qs(u.query, keep_blank_values=True)
Esempio n. 6
0
 def __init__(self, engine, path):
     super(S3File, self).__init__(engine, path)
     self.extra_headers = CaseInsensitiveDict()