python-3.xwampautobahncrossbar

How to get Crossbar.io host name?


I write chat using crossbar.io. We have several nodes of chat. I need write statistics about each of nodes, that's why I need to get host name where specific node is run.

Is it possible get host name from component instance?

I use last version of crossbar/autobahn and python 3.4.

Expect get - 127.0.0.1 if I use local environment.


Solution

  • Just use the socket library:

    import socket
    
    hostname = socket.gethostname()