Automated broker login and token generator using Firefox ESR and Selenium
Project description
Dvarpal
'Dvarpal' (Sanskrit: द्वारपाल) means 'door guard'. Davrpal aims to provide automated login mechanism for Indian stock brokers.
Supported Brokers
- Upstox
Dvarpal is designed so that support for more brokers can be added easily.
Installation
pip install dvarpal
Prerequisite
Dvarpal uses Selenium + Firefox ESR + Gecko Driver to perform automated logins. Firefox ESR and Gecko Driver have to be installed on operating system. For linux, this is automated in the script install-firefox-esr-geckodriver.sh
For Windows and Mac, it is left upto the user to perform similar installations.
Configuration
Dvarpal picks up configration file from ${HOME}/dvarpal.yaml file. A sample file for
Upstox is shared below. For more samples, refer to config_samples directory.
authn_url: https://api.upstox.com/v2/login/authorization/dialog
authz_url: https://api.upstox.com/v2/login/authorization/token
# The following properties are part of upstox app created for API access
client_id: <your-client-id>
client_secret: <your-client-secret>
redirect_uri: <your-redirect-url>
# TOTP secret key generated using https://help.upstox.com/support/solutions/articles/260343-what-is-totp-and-how-to-enable-totp-for-my-account-
totp_secret_key: <your TOTP secret key>
mobile: <your registered mobile number>
pin: <your pin>
Usage
Starting version 2.0.0, Dvarpal will use Firefox ESR + Gecko Driver. Support for Google Chrome and Undetected Chromedriver have been deprecated. In version 2.0.1, support for Chrome will be removed.
from dvarpal.session_firefox import SessionManager
session_manager = SessionManager()
session_manager.generate_access_token() # to generate a new access token
session_manager.is_session_valid() # to check if access token is valid
session_manager.get_access_token() # get the actual access token string
Upon generating an access_token, it is saved to text file ${HOME}/dvarpal_session.
Before generating a new access token, dvarpal checks the file. If file exists, it loads
the access token from file and uses it. If the
token is expired or invalid, dvarpal generates a new one.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dvarpal-2.0.0.tar.gz.
File metadata
- Download URL: dvarpal-2.0.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9400f0251fddf362e4435c6596a1dbfd2689d6e7b9f00339a3f710f2c3d58d39
|
|
| MD5 |
c0103d94f4bcdc13694a7cfe30905516
|
|
| BLAKE2b-256 |
b2176ac903ae7645b578141cb945f2dc87f599c04ad8c7a8031fe71e72cba464
|
File details
Details for the file dvarpal-2.0.0-py3-none-any.whl.
File metadata
- Download URL: dvarpal-2.0.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15ea8c9592195559d32ed90268c9c8102453a4f10f65b25b6dea5c38469bdfcd
|
|
| MD5 |
0dfa053328561390e6d8064c4095df65
|
|
| BLAKE2b-256 |
716c2b5d1ca21325ba600831148d78b9fcbb11dfd9eb0d92c09174cb9bfcb001
|