Closed joelthill closed 3 years ago
Do you have any "'#" or ";" chars in the password field? or any of '=', ':'
Hi James,
No such special chars. After a series of additional tests however, it seems that my first suspect probably isn't the cause of the problem.
please find below some code that should IMHO always run properly, with the logging output and the credentials.propoerties file following :
client = EntityAPI(username="XPH526", password="XXXXXXXXXX", tenant="AN", server="arcacc-dev.ctie.etat.lu")
logging.info("passed login with explicit credentials")
client.save_config()
logging.info("passed save config")
client = EntityAPI()
logging.info("passed login with stored credentials")
DEBUG:pyPreservica.common:Token Expired Requesting New Token
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): arcacc-dev.ctie.etat.lu:443
DEBUG:urllib3.connectionpool:https://arcacc-dev.ctie.etat.lu:443 "POST /api/accesstoken/login HTTP/1.1" 200 148
DEBUG:urllib3.connectionpool:https://arcacc-dev.ctie.etat.lu:443 "GET /api/entity/versiondetails/version HTTP/1.1" 200 None
DEBUG:pyPreservica.common:pyPreservica version: 1.0.1 (Preservica 6.3 Compatible) Connected to: arcacc-dev.ctie.etat.lu Preservica version: 6.2.0 as XPH526 in tenancy AN
DEBUG:pyPreservica.common:http://preservica.com/XIP/v6.2
DEBUG:pyPreservica.common:http://preservica.com/EntityAPI/v6.2
INFO:root:passed login with explicit credentials
INFO:root:passed save config
DEBUG:pyPreservica.common:Token Expired Requesting New Token
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): arcacc-dev.ctie.etat.lu:443
DEBUG:urllib3.connectionpool:https://arcacc-dev.ctie.etat.lu:443 "POST /api/accesstoken/login HTTP/1.1" 400 119
ERROR:pyPreservica.common:Failed to create a password based authentication token. Check your credentials are correct
ERROR:pyPreservica.common:b'{"success":false,"version":1,"message":"missing.mandatory.parameter Required String parameter \'tenant\' is not present"}'
Traceback (most recent call last):
File "C:\Users\xph526\PycharmProjects\test-pypreservica\main.py", line 30, in
[credentials] username = XPH526 password = XXXXXXXXXX tenant = AN server = arcacc-dev.ctie.etat.lu
cheers j.
I have just tried your script:
from pyPreservica import *
logging.basicConfig(level=logging.DEBUG)
client = EntityAPI(username="xxxxxx@preservica.com", password="XXXXXX", tenant="SALES", server="preview.preservica.com")
logging.info("passed login with explicit credentials")
client.save_config()
logging.info("passed save config")
client = EntityAPI()
logging.info("passed login with stored credentials")
print(client)
and it worked ok here using 1.0.1, it seems to be an issue with the tenancy?
the output was
DEBUG:pyPreservica.common:Token Expired Requesting New Token DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): preview.preservica.com:443 DEBUG:urllib3.connectionpool:https://preview.preservica.com:443 "POST /api/accesstoken/login HTTP/1.1" 200 183 DEBUG:urllib3.connectionpool:https://preview.preservica.com:443 "GET /api/entity/versiondetails/version HTTP/1.1" 200 None DEBUG:pyPreservica.common:pyPreservica version: 1.0.1 (Preservica 6.3 Compatible) Connected to: preview.preservica.com Preservica version: 6.3.1 as xxxxxx@preservica.com in tenancy SALES DEBUG:pyPreservica.common:http://preservica.com/XIP/v6.3 DEBUG:pyPreservica.common:http://preservica.com/EntityAPI/v6.3 INFO:root:passed login with explicit credentials INFO:root:passed save config DEBUG:pyPreservica.common:Token Expired Requesting New Token DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): preview.preservica.com:443 DEBUG:urllib3.connectionpool:https://preview.preservica.com:443 "POST /api/accesstoken/login HTTP/1.1" 200 556 DEBUG:urllib3.connectionpool:https://preview.preservica.com:443 "GET /api/entity/versiondetails/version HTTP/1.1" 200 None DEBUG:pyPreservica.common:pyPreservica version: 1.0.1 (Preservica 6.3 Compatible) Connected to: preview.preservica.com Preservica version: 6.3.1 as xxxxxx@preservica.com in tenancy SALES DEBUG:pyPreservica.common:http://preservica.com/XIP/v6.3 DEBUG:pyPreservica.common:http://preservica.com/EntityAPI/v6.3 INFO:root:passed login with stored credentials pyPreservica version: 1.0.1 (Preservica 6.3 Compatible) Connected to: preview.preservica.com Preservica version: 6.3.1 as xxxxxx@preservica.com in tenancy SALES
I have created a new version 1.0.2, can you install it and re-try
pip install -U pyPreservica
problem solved by updating - works like a charm.
thx j.
Hi,
I am experiencing problems with special caracters (e.g. ?!) in e.g. passwords when using stored "credentials.properties". Access fails on EntityAPI for both options - when creating the file manually and when saving a successful connection. Coded credentials work perfectly. I have tried to quote the values in the credentials file, but that also fails.
any ideas?
cheers Joel