Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python signalR - 500 Server Error when trying to connect

Tags:

python

signalr

i trying to connect to a signalR api using this lib

https://pypi.org/project/signalr-client/

here is my code

from requests import Session
from signalr import Connection

with Session() as session:
    #create a connection
    connection = Connection("https://firouzex.exphoenixtrade.com/realtime", session)

    #get chat hub
    chat = connection.register_hub('GetNewAPIToken')

    #start a connection
    connection.start()

but i get this error

$ python test.py
Traceback (most recent call last):
  File "test.py", line 12, in <module>
    connection.start()
  File "C:\Users\Rooz\AppData\Local\Programs\Python\Python35\lib\site-packages\signalr\_connection.py", line 47, in start
    negotiate_data = self.__transport.negotiate()
  File "C:\Users\Rooz\AppData\Local\Programs\Python\Python35\lib\site-packages\signalr\transports\_auto_transport.py", line 16, in negotiate
    negotiate_data = Transport.negotiate(self)
  File "C:\Users\Rooz\AppData\Local\Programs\Python\Python35\lib\site-packages\signalr\transports\_transport.py", line 28, in negotiate
    negotiate.raise_for_status()
  File "C:\Users\Rooz\AppData\Local\Programs\Python\Python35\lib\site-packages\requests\models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://firouzex.exphoenixtrade.com/realtime/negotiate?clientProtocol=1.5&connectionData=%5B%7B%22name%22%3A+%22GetNewAPIToken%22%7D%5D
like image 381
hretic Avatar asked Jun 23 '19 16:06

hretic


1 Answers

I am unable to reproduce your error. The problem may be due to corrupted or outdated packages, maybe a fresh install will solve your problem. The SignalR library is dependent on these packages

certifi, idna, chardet, urllib3, requests, websocket-client, greenlet, pycparser, cffi, gevent, sseclient, signalr-client

To do a fresh install, first uninstall the packages

python -m pip uninstall -y certifi, idna, chardet, urllib3, requests, websocket-client, greenlet, pycparser, cffi, gevent, sseclient, signalr-client

Then to reinstall

python -m pip install certifi, idna, chardet, urllib3, requests, websocket-client, greenlet, pycparser, cffi, gevent, sseclient, signalr-client --upgrade
like image 58
nathancy Avatar answered Nov 15 '22 00:11

nathancy