How to generate PIN?
HP
@HP
Best posts made by HP
Latest posts made by HP
-
Forget login issue
from smartapi.smartWebSocketV2 import SmartWebSocketV2
from smartapi import SmartConnect
import pyotpdef angelbrok_login():
try:
global feed_token, client_code, angel, password, totpangel = SmartConnect(api_key="") client_code = " " password = " " qrOtp = " " totp = pyotp.TOTP(qrOtp) totp = totp.now() data = angel.generateSession(client_code,password,totp) refreshToken = data['data']['refreshToken'] feed_token = angel.getfeedToken() print("Login successful") except Exception as e: print("Error in login", e)
Note: once you login successfully, do not try to generate again,
who will resolve my "In on pong function==> b'\x00'" issue ? -
what if I do not have android or IOS Phone?
what if I do not have android or IOS Phone? ask to SEBI
-
RE: WebSocketV2 not working to get Live Feed
@J88913 said in WebSocketV2 not working to get Live Feed:
from SmartApi.smartWebSocketV2 import SmartWebSocketV2
AUTH_TOKEN = 'Bearer eyJhbGciOiJIUzUxMiJ9.eyJ1c2VybmFtZSI6Iko4ODkxMyIsInJvbGVzIjowLCJ1c2VydHlwZSI6IlVTRVIiLCJpYXQiOjE2NjAxMDc2MDIsImV4cCI6MTc0NjUwNzYwMn0.GxHWWlTKnC-pGIyrz_PLBpwz4Dw2qYdQTTqum5KUKgSsaHFsts1gP1kzgkJELfTAbFmnlyA1dQtgruNP_5vWBQ'
API_KEY = 'IpUZc95q'
CLIENT_CODE = 'J77913'
FEED_TOKEN = '0935239566'
correlation_id = "erroroutp1"
action = 1
mode = 3
token_list = [{"exchangeType": 1, "tokens": ["11536"]}]
sws = SmartWebSocketV2(AUTH_TOKEN, API_KEY, CLIENT_CODE, FEED_TOKEN)
def on_data(wsapp, message):
print("Ticks: {}".format(message))
def on_open(wsapp):
print("on open")
sws.subscribe(correlation_id, mode, token_list)
def on_error(wsapp, error):
print(error)
def on_close(wsapp):
print("Close")Assign the callbacks.
sws.on_open = on_open
sws.on_data = on_data
sws.on_error = on_error
sws.on_close = on_closesws.connect()
I am using the above code but do not get any live feed. Only received following output
on open
In on pong function==> b'\x00'
In on pong function==> b'\x00'
In on pong function==> b'\x00' -
RE: API is down please fix it
@admin ss = SmartWebSocket(FEED_TOKEN, CLIENT_CODE)
TypeError: init() should return None, not 'str'