OpenApi-5p / py5paisa

Official Python SDK for 5paisa APIs natively written in VB .NET
https://5paisa.github.io
89 stars 68 forks source link

'FivePaisaClient' object has no attribute 'WEBSOCKET_URL' #293

Open knkrth opened 4 months ago

knkrth commented 4 months ago

When I try to subscribe to a token feed using,

req_list=[
            { "Exch":"N","ExchType":"C","ScripCode":1660},
            ]

req_data=client.Request_Feed('mf','s',req_list)
def on_message(ws, message):
    print(message)

client.connect(req_data)

client.receive_data(on_message)

I get the following errors, 08:54:33 | 'FivePaisaClient' object has no attribute 'WEBSOCKET_URL' 08:54:33 | 'NoneType' object has no attribute 'on_message'

I'm using Python 3.11.2

knkrth commented 4 months ago

Removing this line fix the problem py5paisa/py5paisa.py#L531

@5paisa I left it open so that it can be fixed.

pradeep6464 commented 4 months ago

After making that change, Logged in > Steaming started Message comes But the data is not being recd

PShiw commented 2 months ago

Replace below 3 lines from py5paisa/py5paisa.py#L531, py5paisa/py5paisa.py#L531 and py5paisa/py5paisa.py#L531

            # if self.WEBSOCKET_URL == '':
            #     self.WEBSOCKET_URL=self.decode_token(self.Jwt_token)

            self.web_url = f'wss://openfeed.5paisa.com/Feeds/api/chat?Value1={self.Jwt_token}|{self.client_code}'

Or refer below image. Change from image to image

It should work.

Mrjp17 commented 1 week ago

Thanks man helped a lot i have forked it fixing this again thanks a lot (´˘ -˘ 人).