Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SSL: UNEXPECTED_EOF_WHILE_READING] #1549

Closed
GauravDucker opened this issue Jan 27, 2025 · 4 comments
Closed

[SSL: UNEXPECTED_EOF_WHILE_READING] #1549

GauravDucker opened this issue Jan 27, 2025 · 4 comments
Assignees

Comments

@GauravDucker
Copy link

GauravDucker commented Jan 27, 2025

Description:
I'm encountering an SSL error when trying to fetch API permissions using the Binance Python SDK. Specifically, the program fails with an SSLError mentioning [SSL: UNEXPECTED_EOF_WHILE_READING]. This happens every time I try to call the /sapi/v1/account/apiRestrictions endpoint, even though my API keys and setup seem correct.

Steps to Reproduce:
Here’s how you can recreate the issue:

Install the Binance Python SDK (python-binance) and set up a .env file with your API keys.
Run the following code:

import os
from binance.client import Client
from dotenv import load_dotenv

load_dotenv()

api_key = os.getenv('BINANCE_API_KEY')
api_secret = os.getenv('BINANCE_API_SECRET')

client = Client(api_key, api_secret)

try:
permissions = client.get_account_api_permissions()
print("Permissions:", permissions)
except Exception as e:
print(f"Error fetching API permissions: {e}")

Actual Behavior:
Instead, the program throws this error:

Error fetching API permissions: HTTPSConnectionPool(host='api.binance.com', port=443): Max retries exceeded with url: /sapi/v1/account/apiRestrictions?recvWindow=10000&timestamp=1737981224669&signature=b93f746ef5d9529257ced13064a94d529816f45ce3a57eaf483179ba067c1685 (Caused by SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1000)')))

please excust the formating of the code im new to coding

@carlosmiei
Copy link
Collaborator

Hello @GauravDucker,

Are the other methods working?

@carlosmiei carlosmiei self-assigned this Jan 28, 2025
@GauravDucker
Copy link
Author

i have reset my keys a couple of times , ensured that i have the correct permissions , my ip seems to be fine as i saw a previously raised complaint about it causing such issues . this only happens with when i try and use any of the account end points none of the other endpoints seem to be having this issue

@carlosmiei
Copy link
Collaborator

@GauravDucker I have tested and it works on my end:

    res = await client.get_account_api_permissions()
    print('after', res)
after {'ipRestrict': False, 'createTime': 1720021635000, 'enableReading': True, 'enableSpotAndMarginTrading': False, 'enableWithdrawals': False, 'enableInternalTransfer': False, 'enableMargin': False, 'enableFutures': False, 'permitsUniversalTransfer': False, 'enableVanillaOptions': False, 'enablePortfolioMarginTrading': False, 'enableFixApiTrade': False, 'enableFixReadOnly': False}

@GauravDucker
Copy link
Author

yeah i tried the exact same code, i upgraded my open ssl version which caused problems i think its an issue on my end illfigure somethingh out cause not the error codes are differen ssl c -2015 and ssl c 1018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants