Exporting openHistorian data to Python

Is there any way to extract open Historian data into Python for better analytics using openHistorian.db instance?

Thanks Ritchie for providing the openHistorian Python API. Just a quick question do we need to configure snapDB separately as when I am running the code to connect to my localhost server where openHistorian is hosted I am getting this error : -

Connecting to openHistorian…
Failed to connect: Unexpected server response: 72

which is actually an exception thrown after this execution:

def readTest():

# Create historian connection (the root API object)

historian = historianConnection("localhost:8182")

instance: Optional[historianInstance] = None


    print("Connecting to openHistorian...")


Try leaving the port number out:

historian = historianConnection("localhost")

The openHistorian API, by default, listens on 38402 not 8182.


Hi Rithcie,
Thanks for your response. I implemented this too by opening the port 38402 on my system too but then too I am receiving this message:

Connecting to openHistorian…
Failed to connect: [WinError 10061] No connection could be made because the target machine actively refused it

Check the following:
(1) openHistorian service is running
(2) Windows firewall is turned off (or allow openHistorian.exe or ports as an exception)