API connection error with demo account (Python code)

Hi, and thanks in advance for the support.
The error arises sometimes when the code runs for some time.
The code is currently running every 15 min (for 15 min time frame candles) to elaborate and send trading signals for an EMA strategy. I’m having this connection error and therefore I’m stuck without possibility to connect and get the price data.
Is there any possibility to force the disconnection? Please find below some consideration:

  • Demo account;
  • Test done from the home internet connection, the error connection is below;
  • Test done from the office internet connection, the error connection is below;

Thanks in advance for the reply.

con = fxcmpy.fxcmpy(access_token=TOKEN)
|WARNING|2019-06-20 11:16:10,608|api-demo.fxcm.com:443/socket.io [connection error] recv disconnected ([WinError 10035] Impossibile completare immediatamente l’operazione sul socket non a blocchi)
|ERROR|2019-06-20 11:16:13,080|Error: Not authorized
Exception in thread Thread-22:
Traceback (most recent call last):
File “C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\threading.py”, line 916, in _bootstrap_inner
self.run()
File “C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\threading.py”, line 864, in run
self._target(*self._args, **self.kwargs)
File “C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\site-packages\fxcmpy\fxcmpy.py”, line 2364, in connect
self.socket.wait()
File "C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\site-packages\socketIO_client_init
.py", line 251, in wait
self.process_packets()
File "C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\site-packages\socketIO_client_init
.py", line 278, in _process_packets
self.process_packet(engineIO_packet)
File "C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\site-packages\socketIO_client_init
.py", line 491, in process_packet
delegate(parse_socketIO_packet_data(socketIO_packet_data), namespace)
File "C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\site-packages\socketIO_client_init
.py", line 523, in _on_error
namespace._find_packet_callback(‘error’)(*data_parsed.args)
File “C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\site-packages\fxcmpy\fxcmpy.py”, line 2756, in on_error
raise ServerError(msg)
fxcmpy.fxcmpy.ServerError: Not authorized

|WARNING|2019-06-20 11:16:59,348|Not connected, try to reconnect. (1)
|ERROR|2019-06-20 11:17:05,968|Error: Not authorized
Exception in thread Thread-25:
Traceback (most recent call last):
File “C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\threading.py”, line 916, in _bootstrap_inner
self.run()
File “C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\threading.py”, line 864, in run
self._target(*self._args, **self.kwargs)
File “C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\site-packages\fxcmpy\fxcmpy.py”, line 2364, in connect
self.socket.wait()
File "C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\site-packages\socketIO_client_init
.py", line 251, in wait
self.process_packets()
File "C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\site-packages\socketIO_client_init
.py", line 278, in _process_packets
self.process_packet(engineIO_packet)
File "C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\site-packages\socketIO_client_init
.py", line 491, in process_packet
delegate(parse_socketIO_packet_data(socketIO_packet_data), namespace)
File "C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\site-packages\socketIO_client_init
.py", line 523, in _on_error
namespace._find_packet_callback(‘error’)(*data_parsed.args)
File “C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\site-packages\fxcmpy\fxcmpy.py”, line 2756, in on_error
raise ServerError(msg)
fxcmpy.fxcmpy.ServerError: Not authorized

|WARNING|2019-06-20 11:17:09,352|Not connected, try to reconnect. (1)
|ERROR|2019-06-20 11:17:15,603|Error: Not authorized
Exception in thread Thread-27:
Traceback (most recent call last):
File “C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\threading.py”, line 916, in _bootstrap_inner
self.run()
File “C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\threading.py”, line 864, in run
self._target(*self._args, **self.kwargs)
File “C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\site-packages\fxcmpy\fxcmpy.py”, line 2364, in connect
self.socket.wait()
File "C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\site-packages\socketIO_client_init
.py", line 251, in wait
self.process_packets()
File "C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\site-packages\socketIO_client_init
.py", line 278, in _process_packets
self.process_packet(engineIO_packet)
File "C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\site-packages\socketIO_client_init
.py", line 491, in process_packet
delegate(parse_socketIO_packet_data(socketIO_packet_data), namespace)
File "C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\site-packages\socketIO_client_init
.py", line 523, in _on_error
namespace._find_packet_callback(‘error’)(*data_parsed.args)
File “C:\Dati\Cartella di lavoro\Portable Software\Python_Portable\WPy-3670\python-3.6.7.amd64\lib\site-packages\fxcmpy\fxcmpy.py”, line 2756, in on_error
raise ServerError(msg)
fxcmpy.fxcmpy.ServerError: Not authorized

hi you need to create a variable with your token number and whyt kind of serve ist is Demo or Live

TOKEN = “your_toke_code”

than

con = fxcmpy.fxcmpy(access_token=TOKEN, log_level =“error” , server =“demo”)

tha it =)