示例#1
0
文件: client.py 项目: lzimm/360io
 def __init__(self, other_params=None, time_tuple=None, api_version=None, *args, **kwargs):
     """Create a Query to submit to EC2."""
     super(Query, self).__init__(*args, **kwargs)
     # Currently, txAWS only supports version 2008-12-01
     if api_version is None:
         api_version = version.ec2_api
     self.params = {
         "Version": api_version,
         "SignatureVersion": "2",
         "SignatureMethod": "HmacSHA256",
         "Action": self.action,
         "AWSAccessKeyId": self.creds.access_key,
         "Timestamp": iso8601time(time_tuple),
     }
     if other_params:
         self.params.update(other_params)
示例#2
0
 def get_call_arguments(self, request):
     result = {
         "action": "SomeAction",
         "version": version.ec2_api,
         "signature_version": 2,
         "expires": None,
         "timestamp": parse(iso8601time(None)),
         "access_key_id": request.args["access_key"][0],
         "signature_method": "Hmacsha256",
         "signature_version": 2,
         "signature": request.args["signature"][0]}
     params = dict((k, v[-1]) for k, v in request.args.iteritems())
     raw = params.copy()
     raw.pop("signature")
     return {"transport_args": result,
             "handler_args": params,
             "raw_args": raw}
示例#3
0
文件: client.py 项目: antisvin/txAWS
 def __init__(self, other_params=None, time_tuple=None, api_version=None,
              *args, **kwargs):
     """Create a Query to submit to EC2."""
     super(Query, self).__init__(*args, **kwargs)
     # Currently, txAWS only supports version 2009-11-30
     if api_version is None:
         api_version = version.ec2_api
     self.params = {
         "Version": api_version,
         "SignatureVersion": "2",
         "Action": self.action,
         "AWSAccessKeyId": self.creds.access_key,
         }
     if other_params is None or "Expires" not in other_params:
         # Only add a Timestamp parameter, if Expires isn't used,
         # since both can't be used in the same request.
         self.params["Timestamp"] = iso8601time(time_tuple)
     if other_params:
         self.params.update(other_params)
     self.signature = Signature(self.creds, self.endpoint, self.params)
示例#4
0
 def __init__(self, other_params=None, time_tuple=None, api_version=None,
              *args, **kwargs):
     """Create a Query to submit to EC2."""
     super(Query, self).__init__(*args, **kwargs)
     # Currently, txAWS only supports version 2009-11-30
     if api_version is None:
         api_version = version.ec2_api
     self.params = {
         "Version": api_version,
         "SignatureVersion": "2",
         "Action": self.action,
         "AWSAccessKeyId": self.creds.access_key,
         }
     if other_params is None or "Expires" not in other_params:
         # Only add a Timestamp parameter, if Expires isn't used,
         # since both can't be used in the same request.
         self.params["Timestamp"] = iso8601time(time_tuple)
     if other_params:
         self.params.update(other_params)
     self.signature = Signature(self.creds, self.endpoint, self.params)
示例#5
0
 def get_call_arguments(self, request):
     result = {
         "action": "SomeAction",
         "version": version.ec2_api,
         "signature_version": 2,
         "expires": None,
         "timestamp": parse(iso8601time(None)),
         "access_key_id": request.args["access_key"][0],
         "signature_method": "Hmacsha256",
         "signature_version": 2,
         "signature": request.args["signature"][0]
     }
     params = dict((k, v[-1]) for k, v in request.args.iteritems())
     raw = params.copy()
     raw.pop("signature")
     return {
         "transport_args": result,
         "handler_args": params,
         "raw_args": raw
     }
示例#6
0
 def __init__(self,
              other_params=None,
              time_tuple=None,
              api_version=None,
              *args,
              **kwargs):
     """Create a Query to submit to EC2."""
     super(Query, self).__init__(*args, **kwargs)
     # Currently, txAWS only supports version 2008-12-01
     if api_version is None:
         api_version = version.ec2_api
     self.params = {
         "Version": api_version,
         "SignatureVersion": "2",
         "SignatureMethod": "HmacSHA256",
         "Action": self.action,
         "AWSAccessKeyId": self.creds.access_key,
         "Timestamp": iso8601time(time_tuple),
     }
     if other_params:
         self.params.update(other_params)
示例#7
0
 def test_iso8601time(self):
     self.assertEqual("2006-07-07T15:04:56Z", iso8601time((2006,7,7,15,4,56,
         0, 0, 0)))