コード例 #1
0
 def get_headers(self):
     headers = { 
                'Date': self.date_str
                }
     if self.data:
         headers['Content-Length'] = len(self.data)
         headers['Content-MD5'] = calc_md5(self.data)
     else:
         headers['Content-Length'] = 0
         
     if self.content_type is not None:
         headers['Content-Type'] = self.content_type
         
     if self.bucket_name:
         headers['Host'] = self.host
     
     for k, v in self.metadata.iteritems():
         headers['x-goog-meta-' + k] = v
     for k, v in self.goog_headers.iteritems():
         headers['x-goog-' + k] = v
         
     headers['x-goog-api-version'] = 1
     headers['x-goog-project-id'] = self.project_id
     headers['Authorization'] = self._get_authorization(headers)
     
     return headers
コード例 #2
0
    def get_headers(self):
        headers = {'Date': self.date_str}
        if self.data:
            headers['Content-Length'] = len(self.data)
            headers['Content-MD5'] = calc_md5(self.data)

        if self.content_type is not None:
            headers['Content-Type'] = self.content_type

        if self.bucket_name:
            headers['Host'] = self.host

        for k, v in self.metadata.iteritems():
            headers['x-amz-meta-' + k] = v
        for k, v in self.amz_headers.iteritems():
            headers['x-amz-' + k] = v

        headers['Authorization'] = self._get_authorization(headers)
        return headers
コード例 #3
0
ファイル: s3.py プロジェクト: 520github/CloudBackup
 def get_headers(self):
     headers = { 
                'Date': self.date_str
                }
     if self.data:
         headers['Content-Length'] = len(self.data)
         headers['Content-MD5'] = calc_md5(self.data)
         
     if self.content_type is not None:
         headers['Content-Type'] = self.content_type
         
     if self.bucket_name:
         headers['Host'] = self.host
     
     for k, v in self.metadata.iteritems():
         headers['x-amz-meta-' + k] = v
     for k, v in self.amz_headers.iteritems():
         headers['x-amz-' + k] = v
         
     headers['Authorization'] = self._get_authorization(headers)
     return headers