Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'get' #47

Open
WojciechTeodorowicz opened this issue Sep 27, 2018 · 1 comment
Open

Comments

@WojciechTeodorowicz
Copy link

WojciechTeodorowicz commented Sep 27, 2018

I am getting the following error when i run my code AttributeError: 'NoneType' object has no attribute 'get'

from requests import Session
from signalr import Connection


def main():
    with Session() as session:
        connection = Connection("http://localhost:8089/signalr", session=None)
        presenceservice = connection.register_hub('MyHub')
        key = input("Press E\n")
        while connection:
            if key == 'e':
                 presenceservice.server.invoke('Heartbeat')  
                 presenceservice.client.on('Heartbeat', print("Recieved Heartbeat \n"))
    
            


if __name__ == "__main__":
    main()

Log

Traceback (most recent call last):
  File "C:/Users/user/AppData/Local/Programs/Python/Python37/signalrr.py", line 19, in <module>
    main()
  File "C:/Users/user/AppData/Local/Programs/Python/Python37/signalrr.py", line 10, in main
    connection.start()
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\signalr\_connection.py", line 47, in start
    negotiate_data = self.__transport.negotiate()
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\signalr\transports\_auto_transport.py", line 16, in negotiate
    negotiate_data = Transport.negotiate(self)
  File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\signalr\transports\_transport.py", line 26, in negotiate
    negotiate = self._session.get(url)
AttributeError: 'NoneType' object has no attribute 'get'
@ngunhaSO
Copy link

ngunhaSO commented Nov 7, 2018

You need to pass in the session when you initialize the connection: connection = Connection("http://localhost:8089/signalr", session)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants