Skip to content

Library requires redundant specification of type of client (just annoying) #35

@merretbuurman

Description

@merretbuurman

If I instantiate pyhandle using JSON creds file, it needs me to specify the client inside it, and also in the script (PyHandleClient('rest')):

creds = pyhandle.clientcredentials.PIDClientCredentials.load_from_JSON(credentials_file)
client = pyhandle.handleclient.PyHandleClient('rest').instantiate_with_credentials(creds, HTTPS_verify=False)

Not passing it in the script (PyHandleClient()) fails, even if it is in the JSON file:

# client = pyhandle.handleclient.PyHandleClient().instantiate_with_credentials(creds, HTTPS_verify=False)
Traceback (most recent call last):
File "check_api_interaction_create.py", line 36, in <module>
client = pyhandle.handleclient.PyHandleClient().instantiate_with_credentials(
TypeError: __init__() missing 1 required positional argument: 'client'

If client not provided in JSON, but it's provided in the script (PyHandleClient('rest')):

File "/foo/venv3/lib/python3.6/site-packages/pyhandle-1.0.4-py3.6.egg/pyhandle/clientcredentials.py", line 179, in __init__
raise CredentialsFormatError(msg=msg)
pyhandle.handleexceptions.CredentialsFormatError: Problem with credentials: Client not provided or empty.

If the client provided, but inconsistent - JSON says "db", init says "rest":

raise CredentialsFormatError(msg=msg)
pyhandle.handleexceptions.CredentialsFormatError: Problem with credentials: (['db_host', 'db_user', 'db_password', 'db_name']) are missing or empty.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions