Conversation
Added API versioning support
| if self.version: | ||
| request_headers.update({'Version': self.version}) |
There was a problem hiding this comment.
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.
fredmota
left a comment
There was a problem hiding this comment.
Please review my previous comments, and please make the changes in the init function.
No description provided.