Problem while connecting Alice Blue API

Hi all,

I am trying to connect my Python code with the Alice Blue App.

I am logged into the Alice Blue application. The app was created

Source Code:

import pyotp
from pya3 import * # Aliceblue, Alice_Wrapper
import inspect

# 1. Credentials
alice_user_id = "123456" #Dummy User ID
api_secret = "gVgqeLL3YTOAWpwkKH2fz5PFBkjBu1QJxtfbq92Wzeq98HNbIUgL6iNAnBBLzvURi9NM0PWWvDsSDtxdFmjyeBjDsqGhKuaReKtI"

try:
    print("Attempting to generate Session ID...")
    # Generate the session ID
    alice = Aliceblue(user_id=alice_user_id, api_key=api_secret)

    # Inspect signature (helps you call correctly)
    print("get_session_id signature:", inspect.signature(alice.get_session_id))

    session_id = alice.get_session_id()
    session_token = session_id['sessionID']

    # 2. Check whether session ID was generated successfully
    # A valid session ID is a string; an error usually returns a dict or None
    if isinstance(session_id, str) and len(session_id) > 10:
        print(f"✅ Success! Session ID generated: {session_id[:5]}...[hidden]")

        # 3. Initialize the authenticated client
        alice = Aliceblue(user_id=alice_user_id, session_id=session_id)

        # 4. Fetch your account balance details
        print("\nFetching balance details...")
        balance_response = alice.get_balance()

        # Format the response cleanly using the official Alice_Wrapper
        clean_balance = Alice_Wrapper.get_balance(balance_response)
        print(clean_balance)

    else:
        # Handle cases where the server returns a error dictionary or invalid type
        print("❌ Failed to generate Session ID.")
        print(f"Server response context: {session_id}")

except Exception as e:
    print(f"An unexpected error occurred during execution: {e}")

I am getting the following error:

Attempting to generate Session ID…
get_session_id signature: (data=None)
An unexpected error occurred during execution: ‘sessionID’

Process finished with exit code 0

Please help me with the remediation of the problem,

Hi @soniharsh1

We have forwarded your query to the concerned team, and they are working on it. We will get it resolved at the earliest.