Example #1
0
    def __init__(self, endpoint, access_key, secret_key, _ioloop=None, accNumber=None, secure=False):
        """
        @type endpoint: the amazon endpoint of the service
        @type endpoint: str
        @type access_key: amazon access key
        @type access_key: str
        @type secret_key: amazon secret key
        @type secret_key: str
        @type _ioloop: the tornado ioloop for processing the events
        @type _ioloop: tornado.ioloop.IOLoop
        @type accNumber: the amazon user id (account number), if None the client will try to fetch the info with IAMClient
        @type accNumber: str
        @type secure: use https
        @type secure: bool
        """

        self.checkForErrors = MethodType(awsutils.sqsclient.SQSClient.checkForErrors, self)

        AWSClient.__init__(self, endpoint, access_key, secret_key, secure, _ioloop = _ioloop)
        #try to retrieve the curent user's account number
        if accNumber is None:
            #TODO, we should do this asynchronous
            iam = IAMClient(access_key, secret_key)
            userinfo = iam.getUser()
            self.accNumber = userinfo['UserId']
            iam.closeConnections()
            iam = None
        else:
            self.accNumber = accNumber
Example #2
0
 def __init__(self, endpoint, access_key, secret_key, accNumber=None, secure=False):
     AWSClient.__init__(self, endpoint, access_key, secret_key, secure)
     #try to retrieve the curent user's account number
     if accNumber is None:
         iam = IAMClient(access_key, secret_key)
         userinfo = iam.getUser()
         self.accNumber = userinfo['UserId']
         iam.closeConnections()
         iam = None
     else:
         self.accNumber = accNumber