Not able to connect to my account

My code was working properly until a couple of hours ago, but now it won’t connect to my account, I have observed this since last 3 days and it works intermittently but rest of the time it doesnt even print anything. not even exceptions nothing, as if it got stuck or something. I did create a new api but the issue still persists.

my client is intialized properly

client = Spot(api_key=api_key, api_secret=api_secret, base_url=“https://api.binance.com”)

for _ in range(retry_count):
sync_time()
try:
account_info = client.account()
print(account_info) #debug
if account_info:
print(“Successfully connected to API”)
print(account_info)
break
else:
print(“Connection unuccessfull”)
except requests.exceptions.ConnectionError as e:
print(f"Connection error: {e}. Retrying in {retry_delay} seconds.")

Can someone tell me what could cause this?

I have been running it since more than a month now but I started noticing this issue since last 3 days.

Hey,
Everything looks correct. Could you share how you’re importing the library you referred to as Spot?

@albin this is how I am importing it:

from binance.spot import Spot
from binance.exceptions import BinanceAPIException
import binance.error

Today I have started getting this error, which was working fine so far: Traceback (most recent call last):
File “C:\Users\Ram\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.11\arb1.py”, line 1, in
from binance.spot import Spot
File “C:\Users\Ram\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Python 3.11\binance.py”, line 8, in
from binance.spot import Spot
ModuleNotFoundError: No module named ‘binance.spot’; ‘binance’ is not a package

I cross checked their documentation but this is how they are importing it:binance-connector-python/examples/spot/market/ticker_24hr.py at master · binance/binance-connector-python · GitHub

Did you download the binance-futures-connector-python library as well?

Nope, I have not since I did not need it.

Which version of the connector are you using?

I was using 3.9, I tried with 3.10 and 3.8.1 but it is not even importing the library anymore.