Example #1
0
    def __get_auth(self):
        '''Return auth headers. Will use API Keys if present in settings.'''

        if self.shouldAuth is False:
            return []

        self.logger.info("Authenticating with API Key.")
        # To auth to the WS using an API key, we generate a signature of a nonce and
        # the WS API endpoint.
        nonce = generate_nonce()
        return [
            "api-nonce: " + str(nonce),
            "api-signature: " + generate_signature(settings.API_SECRET, 'GET', '/realtime', nonce, ''),
            "api-key:" + settings.API_KEY
        ]
Example #2
0
    def __get_auth(self):
        '''Return auth headers. Will use API Keys if present in settings.'''

        if self.shouldAuth is False:
            return []

        self.logger.info("Authenticating with API Key.")
        # To auth to the WS using an API key, we generate a signature of a nonce and
        # the WS API endpoint.
        nonce = generate_nonce()
        return [
            "api-nonce: " + str(nonce),
            "api-signature: " + generate_signature(settings.API_SECRET, 'GET', '/realtime', nonce, ''),
            "api-key:" + settings.API_KEY
        ]
Example #3
0
    def __get_auth(self):
        '''Return auth headers. Will use API Keys if present in settings.'''

        if self.shouldAuth is False:
            return []

        self.logger.info("Authenticating with API Key.")
        # To auth to the WS using an API key, we generate a signature of a nonce and
        # the WS API endpoint.
        self.endpoint = pickle.load(open('ws_url', 'rb'))
        self.secret = pickle.load(open('ws_secret', 'rb'))
        self.key = pickle.load(open('ws_key', 'rb'))
        nonce = generate_nonce()
        return [
            "api-nonce: " + str(nonce), "api-signature: " +
            generate_signature(self.secret, 'GET', '/realtime', nonce, ''),
            "api-key:" + self.key
        ]
Example #4
0
 def __get_auth(self):
     '''Return auth headers. Will use API Keys if present in settings.'''
     if not settings.API_KEY:
         self.logger.info("Authenticating with email/password.")
         return [
             "email: " + settings.LOGIN,
             "password: "******"Authenticating with API Key.")
         # To auth to the WS using an API key, we generate a signature of a nonce and
         # the WS API endpoint.
         nonce = generate_nonce()
         return [
             "api-nonce: " + str(nonce),
             "api-signature: " + generate_signature(settings.API_SECRET, 'GET', '/realtime', nonce, ''),
             "api-key:" + settings.API_KEY
         ]
Example #5
0
    def __get_auth(self):
        '''Return auth headers. Will use API Keys if present in settings.'''
        if not self.config['API_KEY'] and not self.config['LOGIN']:
            self.logger.error("No authentication provided! Unable to connect.")
            sys.exit(1)

        if not self.config['API_KEY']:
            self.logger.info("Authenticating with email/password.")
            return [
                "email: " + self.config['LOGIN'],
                "password: "******"Authenticating with API Key.")
            # To auth to the WS using an API key, we generate a signature of a nonce and
            # the WS API endpoint.
            nonce = generate_nonce()
            return [
                "api-nonce: " + str(nonce),
                "api-signature: " + generate_signature(self.config['API_SECRET'], 'GET', '/realtime', nonce, ''),
                "api-key:" + self.config['API_KEY']
            ]
Example #6
0
    def __get_auth(self):
        '''Return auth headers. Will use API Keys if present in settings.'''
        if not self.config['API_KEY'] and not self.config['LOGIN']:
            self.logger.error("No authentication provided! Unable to connect.")
            sys.exit(1)

        if not self.config['API_KEY']:
            self.logger.info("Authenticating with email/password.")
            return [
                "email: " + self.config['LOGIN'],
                "password: "******"Authenticating with API Key.")
            # To auth to the WS using an API key, we generate a signature of a nonce and
            # the WS API endpoint.
            nonce = generate_nonce()
            return [
                "api-nonce: " + str(nonce),
                "api-signature: " + generate_signature(
                    self.config['API_SECRET'], 'GET', '/realtime', nonce, ''),
                "api-key:" + self.config['API_KEY']
            ]