Closed rajkiranjeet closed 3 weeks ago
you do not need to create the totp yourself, just add the totp_secret to the "totpstr" key in create_headers
thanks wokring perfect but its ok for placing order hwo about live stream websocket if we get supertoken or session id something then we can mamage same seeion throughout process can u guide me about this
This library does not include websockets for brokers, only REST APIs. Please keep your questions to REST APIs, you can follow the broker documentation for Websockets.
i try to finvasia
Session Created Successfully Error creating session or placing order: Non-base32 digit found below is my code import pyotp from fenix.finvasia import finvasia
TOTP Secret and Credentials
totp_secret = "24242424"
Padding the secret if necessary
def pad_base32_secret(secret): missing_padding = len(secret) % 8 if missing_padding: secret += '=' * (8 - missing_padding) return secret
Pad the TOTP secret
padded_totp_secret = pad_base32_secret(totp_secret)
Generate TOTP Token
try: totp = pyotp.TOTP(padded_totp_secret) totp_token = totp.now() print(f"Generated TOTP Token: {totp_token}")
except Exception as e: print(f"Error creating session or placing order: {e}")