def _get_auth(self):
     nonce = generate_nonce()
     return [
         f"api-nonce: {nonce}",
         f"api-signature: {generate_signature(self.api_secret, 'GET', '/realtime', nonce, '')}",
         f"api-key:{self.api_key}"
     ]
예제 #2
0
def generate_headers(api_secret, api_public, url, method, data):
    nonce = generate_nonce()
    headers = {
        "api-nonce":
        str(nonce),
        "api-signature":
        generate_signature(api_secret, method, url, nonce, json.dumps(data)),
        "api-key":
        api_public
    }
    return headers
예제 #3
0
 def __get_auth(self):
     """Return auth headers. Will use API Keys if present in settings."""
     if self.api_key:
         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(self.api_secret, 'GET', '/realtime', nonce, ''),
             "api-key:" + self.api_key
         ]
     else:
         self.logger.info("Not authenticating.")
         return []
예제 #4
0
 def __get_auth(self):
     '''Return auth headers. Will use API Keys if present in settings.'''
     if self.api_key:
         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.
         expires = generate_nonce()
         return [
             "api-expires: " + str(expires),
             "api-signature: " + generate_signature(self.api_secret, 'GET', '/api/v1/signature', expires, ''),
             "api-key:" + self.api_key
         ]
     else:
         self.logger.info("Not authenticating.")
         return []
예제 #5
0
 def __get_auth(self):
     '''Return auth headers. Will use API Keys if present in settings.'''
     if self.config['api_key']:
         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(self.config['api_secret'], 'GET', '/realtime', nonce, ''),
             "api-key:" + self.config['api_key']
         ]
     else:
         self.logger.info("Not authenticating.")
         return []
예제 #6
0
 def __get_auth(self):
     '''Return auth headers. Will use API Keys if present in settings.'''
     if self.config['api_key']:
         print("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']
         ]
     else:
         print("Not authenticating.")
         return []
 def __get_auth(self):
     '''Return auth headers. Will use API Keys if present in settings.'''
     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']
         ]