Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add extra headers to all requests, if they exist #1012

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion S3/S3.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import mimetypes
import io
import pprint
from copy import copy
from xml.sax import saxutils
from logging import debug, info, warning, error
from stat import ST_SIZE
Expand Down Expand Up @@ -1123,7 +1124,13 @@ def create_request(self, operation, uri = None, bucket = None, object = None, he

method_string = S3.http_methods.getkey(S3.operations[operation] & S3.http_methods["MASK"])

request = S3Request(self, method_string, resource, headers, body, uri_params)
_headers = copy(headers)
if not _headers and self.config.extra_headers is not None:
_headers = {}
if self.config.extra_headers is not None:
for k,v in self.config.extra_headers.iteritems():
_headers[k] = v
request = S3Request(self, method_string, resource, _headers, body, uri_params)

debug("CreateRequest: resource[uri]=%s", resource['uri'])
return request
Expand Down