I am currently integrating the Upstox Python SDK into my project and have encountered an issue while attempting to authenticate and generate the login URL. I have followed the steps provided in your GitHub repository (GitHub - upstox/upstox-python: Official Python SDK for accessing Upstox API) and installed the SDK successfully. However, when I run my script, I encounter the following error:
Traceback (most recent call last):
File "/home/iuser/algo-platform/upstox-python/test_upstox_auth.py", line 2, in <module>
from upstox_client import Upstox
ImportError: cannot import name 'Upstox' from 'upstox_client' (/home/iuser/algo-platform/upstox-python/upstox_client/__init__.py)```
Here’s a summary of what I’ve done:
1. Cloned the repository from https://github.com/upstox/upstox-python.git.
2. Installed the SDK using pip install . within the repository directory.
3. Created a test script (test_upstox_auth.py) with the following content:
import os
from upstox_client import Upstox
API_KEY = os.getenv(‘API_KEY’)
API_SECRET = os.getenv(‘API_SECRET’)
REDIRECT_URI = os.getenv(‘REDIRECT_URI’)
upstox = Upstox(API_KEY, API_SECRET)
login_url = upstox.get_login_url()
print(f"Login URL: {login_url}")
4. Verified the installation of the SDK (pip list shows upstox-python-sdk 2.9.0 is installed).
Despite these steps, I receive the ImportError mentioned above. I also checked the structure of the upstox_client directory and could not locate the Upstox class directly under the module.
Could you please provide guidance on:
1. The correct import path for the Upstox class.
2. Any additional steps or configurations required to resolve this issue.
Your assistance would be greatly appreciated. Please let me know if you need further details or logs.