-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IdentityServicesEngineAPI Class: Add username as property #21
Comments
Hi, @netgab. I am currently working on the changes for the properties. |
Hi, @wastorga ,
No need for this... This was not my intention in this enhancement request. |
Hi, @netgab. This is what the next release would look like regarding the properties. https://ciscoisesdk.readthedocs.io/en/develop/api/api.html#ciscoisesdk.IdentityServicesEngineAPI The password and encoded_auth have special methods, is_* and change_*. |
The ApiError would look like this: In [15]: try:
...: r2 = api.endpoint.delete_by_id(id=r1_id)
...: except ciscoisesdk.ApiError as e:
...: print(e)
...: print(e.additional_data)
...: print(e.request.headers)
[401] - Authentication credentials were missing or incorrect.
Check ApiError.additional_data for more info.
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=
Username: username
Password: password
{'User-Agent': 'python-requests/2.27.1', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', 'Connection': 'keep-alive', 'authorization': 'Basic dXNlcm5hbWU6cGFzc3dvcmQ=', 'Content-type': 'application/json;charset=utf-8', 'Content-Length': '0'} |
Finally, this is a more detailed example of how to use it api = IdentityServicesEngineAPI(verify=False, debug=True, uses_csrf_token=True)
api.username = "username"
assert api.username == "username"
api.change_password("password")
assert api.is_password("password")
api.reinitialize() # Distribute our changes reinitializing the IdentityServicesEngineAPI
api2 = IdentityServicesEngineAPI(verify=False, debug=True, perform_initialize=False)
api2.uses_csrf_token = True
api2.debug = False
api2.reinitialize() # Distribute our changes initializing the IdentityServicesEngineAPI |
The ciscoisesdk v1.5.0 is up. Feel free to test it and close or comment if necessary. |
Thank you! |
Is your feature request related to a problem? Please describe.
When sharing an instance of the
IdentityServicesEngineAPI
in various classes, the used parameters in the constructor__init__
might not be accessible in other classes or methods (e.g. when passing the instance as a method parameter). Especially when catching exceptions some of the instance parameters might be helpful for meaningful error messages (e.g. on a 401 error add the username in the exception message)Describe the solution you'd like
It would be helpful to have all properties (ok - we might discuss about the password) used in the constructor as getter (and possibly setter) properties.
The text was updated successfully, but these errors were encountered: