Search code examples
pythonprintingbinance-api-client

How to prevent binance-connector from printing


I'm using binance-connector from:

https://github.com/binance/binance-connector-python

After defining key and secret logging information, I need to run:

import logging
from binance.spot import Spot as Client
from binance.lib.utils import config_logging
config_logging(logging, logging.DEBUG)
client = Client(key, secret)    
results=client.klines(token, "1m", limit=1440)

The last line prints the requested information, but I need to prevent this.

Is it possible to prevent this function from printing the retrieved information?

EDIT

I found that I can retrieve the same information using

import requests
tick_interval = '1m'
limit='1440'
url = 'https://api.binance.com/api/v3/klines?symbol=url'+token+'&interval='+tick_interval+'&limit='+limit
resutls = requests.get(url).json()

This doesn't print the information.

However, I would still like to know if there's some modification I can make to binance-connector library so I can prevent it from printing the retrieved information, because the library basically prints anything I ask it to retrieve, and there's information that I can only get throw this library


Solution

  • You have specified config_logging(logging, logging.DEBUG) that will cause debugging information to be displayed. If you don't need it then feel free to remove that line.