`get_event_loop` deprecation warning

Author: DonVito1982Created Aug 3, 2025Updated Aug 3, 2025

Describe the bug When performing unit tests under pytest that instantiate a binance.client.Client the tests throw a warning like the following

  /home/donvito/.pyenv/versions/algotrading/lib/python3.12/site-packages/binance/helpers.py:96: DeprecationWarning: There is no current event loop
    loop = asyncio.get_event_loop()

To Reproduce Code snippet to reproduce the behavior:

python
import pytest
from binance.client import Client

class TestPopulateHelpers:
    def test_warning_reproduction(self):
        bclient = Client(
            api_key = "some_api_key",
            api_secret = "some_api_secret",
            tld = "com"
            )
        assert 1 == 1

Expected behavior No warnings should be shown.

Environment (please complete the following information):

  • Python version: 3.12
  • Virtual Env: virtualenv
  • OS: Ubuntu
  • python-binance version: 1.0.29

Source: sammchardy/python-binance