Skip to content

Conversation

ccorciu
Copy link
Collaborator

@ccorciu ccorciu commented Feb 15, 2021

No description provided.

Comment on lines +273 to +274
if self.version:
request_headers.update({'Version': self.version})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This very interesting, I didn't know we could select the API version. Very cool!

When using the curl command, 'version' has to be all lower case, otherwise it is ignored. Does 'Version' work in Python?
% curl -s -k -u admin:admin 'https://192.168.29.143:9000/api/ports/P3-32?version=9.0.0'
Unknown Web API version: 9.0.0
% curl -s -k -u admin:admin 'https://192.168.29.143:9000/api/ports/P3-32?Version=9.0.0'
{
"afm_pipeline_direction": "INGRESS",
"burst_buffer_settings": null,
"cdr_bypass_enabled": false,

Isn't it better to have these changes in the init function? That way we only add the version header only once.

If we make the library to support the following syntax:
% curl -s -k -u admin:admin 'https://192.168.29.143:9000/api/ports/P3-32?version=4.4.0'
{
"afm_pipeline_direction": "INGRESS",
"burst_buffer_settings": null,

or
% curl -s -k -u admin:admin 'https://192.168.29.143:9000/api/ports/P3-32?{properties=id&version=4.4.0}'
{"id": 246}
then it will make sense to implement the changes in the _sendRequest function. But then we will have to modify every method so that we could pass the version, or define a setter for the version variable, i.e., @version.setter.

Copy link
Collaborator

@fredmota fredmota left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review my previous comments, and please make the changes in the init function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants