python-binance
python-binance copied to clipboard
Unclosed client session
I'm trying to run a sample code given by the author..
import asyncio
from binance import AsyncClient
async def main():
client = await AsyncClient.create()
exchange_info = await client.get_exchange_info()
tickers = await client.get_all_tickers()
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
throws error;
Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x00000172D0C8DA00> Unclosed connector connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x00000172D0F8E160>, 145114.359)]'] connector: <aiohttp.connector.TCPConnector object at 0x00000172D0E88D00>
just call the async method close_connection().
await client.close_connection()