Требуется соединение SSL.Попробуйте следующее (работает для меня):
import socket
import ssl
import json
host = 'xapia.x-station.eu'
port = 5124
USERID = 123456
PASSWORD = 'YOURPASSWORD'
host = socket.getaddrinfo(host, port)[0][4][0]
s = socket.socket()
s.connect((host, port))
s = ssl.wrap_socket(s)
parameters = {
"command" : "login",
"arguments" : {
"userId": USERID,
"password": PASSWORD
}
}
packet = json.dumps(parameters, indent=4)
s.send(packet.encode("UTF-8"))
END = b'\n\n'
response = s.recv(8192)
if END in response:
print('Print login: {}'.format(response[:response.find(END)]))
parameters = {
"command" : "logout"
}
packet = json.dumps(parameters, indent=4)
s.send(packet.encode("UTF-8"))
response = s.recv(8192)
if END in response:
print('Print logout: {}'.format(response[:response.find(END)]))