carj / pyPreservica

Python language binding for the Preservica API
https://pypreservica.readthedocs.io
Apache License 2.0
14 stars 2 forks source link

delete_asset, manager password, RawConfigParser() #5

Closed joelthill closed 2 years ago

joelthill commented 3 years ago

Hi James,

I was using delete_asset() with both an operator and a manager's password configured in credentials.properties. The manager's password containes special characters (%), which ConfigParser() doesn't appreciate too much, so I was wondering if you would see any specific reason not to switch over to RawConfigParser(), whic does the job?

cheers Joel

carj commented 3 years ago

Ok, let me take a look.

carj commented 3 years ago

I have pushed a new version to pyPI which removes string interpolation of special chars from the parsing of passwords

https://pypi.org/project/pyPreservica/1.1.5/

pip install --upgrade pyPreservica

carj commented 3 years ago

@joelthill can you let me know if that update has fixed your issue. Thanks

joelthill commented 3 years ago

looks like it didn't.

File "[..]\Python\Python39\lib\configparser.py", line 799, in get return self._interpolation.before_get(self, section, option, value, File "[..]\Programs\Python\Python39\lib\configparser.py", line 395, in before_get self._interpolate_some(parser, option, L, value, section, defaults, 1) File "[..]\Python\Python39\lib\configparser.py", line 442, in _interpolate_some raise InterpolationSyntaxError( configparser.InterpolationSyntaxError: '%' must be followed by '%' or '('

I have to either modify the password in order to escape the '%' using '%%', or use RawConfigParser with the unmodified password.

j.