def _query(self, urlpath, req={}, conn=None, headers={}): """Low-level query handling. Arguments: urlpath -- API URL path sans host (string, no default) req -- additional API request parameters (default: {}) conn -- kraken.Connection object (default: None) headers -- HTTPS headers (default: {}) """ url = self.uri + urlpath if conn is None: conn = connection.Connection() ret = conn._request(url, req, headers) return json.loads(ret)
def _query(self, urlpath, req={}, conn=None, headers={}): """Low-level query handling. :param urlpath: API URL path sans host :type urlpath: str :param req: additional API request parameters :type req: dict :param conn: connection TODO :type conn: krakenex.Connection :param headers: HTTPS headers :type headers: dict """ url = self.uri + urlpath if conn is None: if self.conn is None: conn = connection.Connection() else: conn = self.conn ret = conn._request(url, req, headers) return json.loads(ret)
def wrapper(*args, **kargs): """Login befor call apis.""" conn = connection.Connection() client = API(conn=conn) client.load_key('secret/secret.txt') return func(client, *args, **kargs)