MCPcopy Create free account
hub / github.com/s3tools/s3cmd / _http_403_handler

Method _http_403_handler

S3/S3.py:1650–1662  ·  view source on GitHub ↗
(self, request, response, fn, *args, **kwargs)

Source from the content-addressed store, hash-verified

1648 return None
1649
1650 def _http_403_handler(self, request, response, fn, *args, **kwargs):
1651 if 'data' in response and len(response['data']) > 0:
1652 failureCode = getTextFromXml(response['data'], 'Code')
1653 if failureCode == 'AccessDenied':
1654 # traditional HTTP 403
1655 message = getTextFromXml(response['data'], 'Message')
1656 if message == 'AWS authentication requires a valid Date or x-amz-date header': # message from an Eucalyptus walrus server
1657 if not request.use_signature_v2() and not self.fallback_to_signature_v2: # have not tried with v2 yet
1658 debug(u'Falling back to signature v2')
1659 self.fallback_to_signature_v2 = True
1660 return fn(*args, **kwargs)
1661
1662 raise S3Error(response)
1663
1664 def update_region_inner_request(self, request):
1665 """Get and update region for the request if needed.

Callers 3

send_requestMethod · 0.95
send_fileMethod · 0.95
recv_fileMethod · 0.95

Calls 3

getTextFromXmlFunction · 0.85
S3ErrorClass · 0.85
use_signature_v2Method · 0.80

Tested by

no test coverage detected