okxapi / python-okx

398 stars 154 forks source link

Is it possible to turn off the (body: header: domain: url:) info printing /logging on each request? #26

Closed jcabourne closed 9 months ago

xbitlit commented 1 year ago

In module: .../okx/client.py, change to: if self.debug == True: pass

print('domain:',self.domain)

        #print('url:',request_path)

and in module: .../okx/utils.py, change to: def pre_hash(timestamp, method, request_path, body,debug = True): if debug == True: pass

print('body: ',body)

return str(timestamp) + str.upper(method) + request_path + body

def get_header(api_key, sign, timestamp, passphrase, flag,debug = True): header = dict() header[c.CONTENT_TYPE] = c.APPLICATION_JSON header[c.OK_ACCESS_KEY] = api_key header[c.OK_ACCESS_SIGN] = sign header[c.OK_ACCESS_TIMESTAMP] = str(timestamp) header[c.OK_ACCESS_PASSPHRASE] = passphrase header['x-simulated-trading'] = flag if debug == True: pass

print('header: ',header)

return header

def get_header_no_sign(flag,debug = True): header = dict() header[c.CONTENT_TYPE] = c.APPLICATION_JSON header['x-simulated-trading'] = flag if debug == True: pass

print('header: ',header)

return header
khaliduddin commented 11 months ago

As this is an unofficial Python wrapper for the OKX exchange v5 API do you have any plans to remove print statements from the API in upcoming release?

okxapi commented 9 months ago

You may set the API function parameter debug = False

e.g. marketDataAPI = MarketData.MarketAPI(debug=False)