Skip to main content

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

  1. 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

dvarpal-2.0.1.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dvarpal-2.0.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file dvarpal-2.0.1.tar.gz.

File metadata

  • Download URL: dvarpal-2.0.1.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.14

File hashes

Hashes for dvarpal-2.0.1.tar.gz
Algorithm Hash digest
SHA256 d41120e64f6e25b15d1e8e29a8ca154ac464ae38696e1856872452e6cc2efb07
MD5 5cd394dc704b3dff55449ed08ac1bccd
BLAKE2b-256 88b2244e0236b6fa656d3dabd5424ac294291bb4940e15bd7833dde696c80c97

See more details on using hashes here.

File details

Details for the file dvarpal-2.0.1-py3-none-any.whl.

File metadata

  • Download URL: dvarpal-2.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.14

File hashes

Hashes for dvarpal-2.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 42a084e54501b061b7ec371aa39659380915507f79456ecf694ce8b114d8d2ce
MD5 edc35a4f01710ab47c5e84d33aefeb15
BLAKE2b-256 57316788cc29fe0b2121396eeb6524b919a65bea3ec169dd2672b775c348c26b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page