(self, operation, dist_id = None, request_id = None, headers = None)
| 564 | return response |
| 565 | |
| 566 | def create_request(self, operation, dist_id = None, request_id = None, headers = None): |
| 567 | resource = cloudfront_resource + ( |
| 568 | operation['resource'] % { 'dist_id' : dist_id, 'request_id' : request_id }) |
| 569 | |
| 570 | if not headers: |
| 571 | headers = SortedDict(ignore_case = True) |
| 572 | |
| 573 | if "date" in headers: |
| 574 | if "x-amz-date" not in headers: |
| 575 | headers["x-amz-date"] = headers["date"] |
| 576 | del(headers["date"]) |
| 577 | |
| 578 | if "x-amz-date" not in headers: |
| 579 | headers["x-amz-date"] = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.gmtime()) |
| 580 | |
| 581 | if len(self.config.access_token)>0: |
| 582 | self.config.role_refresh() |
| 583 | headers['x-amz-security-token']=self.config.access_token |
| 584 | |
| 585 | signature = self.sign_request(headers) |
| 586 | headers["Authorization"] = "AWS "+self.config.access_key+":"+signature |
| 587 | |
| 588 | request = {} |
| 589 | request['resource'] = resource |
| 590 | request['headers'] = headers |
| 591 | request['method'] = operation['method'] |
| 592 | |
| 593 | return request |
| 594 | |
| 595 | def sign_request(self, headers): |
| 596 | string_to_sign = headers['x-amz-date'] |
no test coverage detected