AnsweredAssumed Answered

Connection Problem using PI-Web-API-Python package

Question asked by Andrew_Li on Aug 4, 2018
Latest reply on Aug 6, 2018 by gregor

Hi all,

I am a new user of osisoft pi-server and I'm currently facing a connection problem.

 

I've tried using PI-Web-API-Python package(GitHub - osimloeff/PI-Web-API-Client-Python: PI Web API client library for Python generated using the Swagger specificat… ) to connect the "https://devdata.osisoft.com/piwebapi" server, and it was success.

baseUrl="https://devdata.osisoft.com/piwebapi"
client = PIWebApiClient(
    baseUrl=baseUrl,
    useKerberos=False,
    username=username,
    password=password,
    verifySsl=True
)
client.home.get()


 

However, I couldn't connect my customer's server when I tried to connect my customer's server with the same code on both Windows7 and MacOS.

There had some result I got such as the following:

 

  • 1.  Couldn't connect the server via ssl verification.

     I got a SSLerror because the self signed certificate on both Windows7 and MacOS operating system.

client = PIWebApiClient(
    baseUrl=baseUrl,
    useKerberos=False,
    username=username,
    password=password,
    verifySsl=True
)

 

2. Couldn't connect the server when I turn off the ssl verification

    I got the 401 error when I turned off the the ssl verification on both Windows7 and MacOS operating system.

client = PIWebApiClient(
    baseUrl=baseUrl,
    useKerberos=False,
    username=username,
    password=password,
    verifySsl=False
)

 

3. Got the KerberosExchangeError when I turn on the Kerberos verification on Windows7.

    Finally, I got some different error from the server.

    I got the KerberosExchangeError(as the attachments: windows_error_msg_use_kerberos.txt) which I had no clue on Windows7.

KerberosExchangeError: authGSSClientStep() failed: ('SSPI: InitializeSecurityContext: �����εL�k�F�쪺���w�ؼ�\r\n',)

client = PIWebApiClient(
    baseUrl=baseUrl,
    useKerberos=True,
    username=username,
    password=password,
    verifySsl=False
)

   P.S. I could connect to the server and be able to get the data from server when I use R package(GitHub - osimloeff/PI-Web-API-Client-R: PI Web API R package which is REST client library to get PI data through PI Web … ) on Windows7.

useKerberos <- TRUE
username <- username
password <- password
validateSSL <- FALSE
debug <- TRUE
piWebApiService <- piwebapi$new(baseUrl, useKerberos, username, password, validateSSL, debug)
response1 = piWebApiService$home$get()

 

4. Got the other KerberosExchangeError when I turn on the Kerberos verification on MacOS.

    I got the KerberosExchangeError(as the attachments: mac_error_msg_use_kerberos.txt) which I had no clue on Windows7.

KerberosExchangeError: authGSSClientStep() failed: ((' Miscellaneous failure (see text)', 851968), ('No credentials cache file found', -1765328189))

client = PIWebApiClient(
    baseUrl=baseUrl,
    useKerberos=True,
    username=username,
    password=password,
    verifySsl=False
)

 

Eventually, I will setup a service on CentOS7, and I have to connect my customer's server(as I described previously...) periodically.

 

May I get some help or hints from anyone?

Such as How can I connect this server via self-signed ssl or via Kerberos protocol?

How can I add the certification to my CentOS operating system?

 

I really want to go through this situation......

Outcomes