(20241223) Zerodha auth now returns views.
This commit is contained in:
@@ -42,10 +42,6 @@ import os
|
||||
# my utils:
|
||||
from utils_v2.string import json
|
||||
|
||||
# To work with SocketIO:
|
||||
import socketio
|
||||
from aiohttp import web
|
||||
|
||||
# For asynchronous activities:
|
||||
import asyncio
|
||||
|
||||
@@ -60,7 +56,8 @@ from icecream import IceCreamDebugger
|
||||
# *****************************************************************************************************************
|
||||
|
||||
|
||||
# --- Nothing Yet
|
||||
# Debugging:
|
||||
printer = IceCreamDebugger(prefix = "SocketIO | ", includeContext = True)
|
||||
|
||||
|
||||
# *****************************************************************************************************************
|
||||
@@ -70,13 +67,7 @@ from icecream import IceCreamDebugger
|
||||
# *****************************************************************************************************************
|
||||
|
||||
|
||||
# The SocketIo server:
|
||||
sio = socketio.AsyncServer(cors_allowed_origins = "*")
|
||||
app = web.Application()
|
||||
sio.attach(app)
|
||||
|
||||
# Debugging:
|
||||
printer = IceCreamDebugger(prefix = "SocketIO | ", includeContext = True)
|
||||
# --- Nothing Yet
|
||||
|
||||
|
||||
# *****************************************************************************************************************
|
||||
@@ -86,30 +77,8 @@ printer = IceCreamDebugger(prefix = "SocketIO | ", includeContext = True)
|
||||
# *****************************************************************************************************************
|
||||
|
||||
|
||||
@sio.event
|
||||
async def connect(sid, environ):
|
||||
printer(sid)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
@sio.event
|
||||
async def disconnect(sid):
|
||||
printer(sid)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
async def init():
|
||||
|
||||
"""
|
||||
Initialize stuff here.
|
||||
:return: ?
|
||||
"""
|
||||
|
||||
pass
|
||||
async def subscribe(sid, data):
|
||||
printer(data)
|
||||
|
||||
|
||||
# *****************************************************************************************************************
|
||||
@@ -121,20 +90,4 @@ async def init():
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
async def main():
|
||||
|
||||
# Start receiving live market data in the background:
|
||||
# asyncio.create_task(start_live_feed())
|
||||
|
||||
# Run the web server:
|
||||
runner = web.AppRunner(app)
|
||||
await runner.setup()
|
||||
site = web.TCPSite(runner, "0.0.0.0", 5214)
|
||||
printer("Server running.")
|
||||
await site.start()
|
||||
|
||||
# Keep the server running:
|
||||
while True: await asyncio.sleep(3_600)
|
||||
|
||||
# Let's go:
|
||||
asyncio.run(main())
|
||||
pass
|
||||
Reference in New Issue
Block a user