python-binance icon indicating copy to clipboard operation
python-binance copied to clipboard

Unclosed client session

Open gorkem2020 opened this issue 3 years ago • 2 comments

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>

gorkem2020 avatar Dec 16 '21 07:12 gorkem2020

just call the async method close_connection().

halfelf avatar Dec 26 '21 10:12 halfelf

await client.close_connection()

Grimmjawe avatar Sep 03 '22 18:09 Grimmjawe