-
Notifications
You must be signed in to change notification settings - Fork 44
Update sdkVersion in graph_session.py #46
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
Update sdkVersion in graph_session.py #46
Conversation
Fixes microsoftgraph#42 Prepended sdkVersion with comma separated new values in self.headers in graph_session.py Modified a test and added another test to check whether the value has been updated correctly
msgraphcore/graph_session.py
Outdated
if 'sdkVersion' not in self.headers: | ||
self.headers.update({'sdkVersion': 'graph-python-' + SDK_VERSION}) | ||
else: | ||
self.headers.update({'sdkVersion': 'graph-python-' + SDK_VERSION + ', ' | ||
+ self.headers.get('sdkVersion')}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put this functionality in a private method _append_sdk_version
and call the function in the constructor.
I prefer checking if sdkVersion
is in headers
first
if 'sdkVersion' in self.headers:
...
else:
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure I'll make the changes!
I have come up with this definition of def _append_sdk_version(self) -> None:
"""Updates sdkVersion in headers with comma-separated new values
"""
if 'sdkVersion' in self.headers:
self.headers.update({'sdkVersion': 'graph-python-' + SDK_VERSION + ', '
+ self.headers.get('sdkVersion')})
else:
self.headers.update({'sdkVersion': 'graph-python-' + SDK_VERSION}) Please let me know what the docstring should be. Is this correct? |
Looks good @rajatdiptabiswas |
Created a private method _append_sdk_version to update sdkVersion in headers
Made the changes you mentioned @jobala. Thanks in advance! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #42
Prepended
sdkVersion
with comma-separated new values inself.headers
ingraph_session.py
Modified a test and added another test to check whether the value has been updated correctly
Kindly check if everything is correct.
If something is wrong, please let me know. I'll try to get it fixed.