-
Notifications
You must be signed in to change notification settings - Fork 29
Implemented convenience method for client id #97
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
base: develop
Are you sure you want to change the base?
Changes from 1 commit
c720dcc
9f9d247
d92aa64
10ec673
12f11b1
132ab4e
38e723b
cca6649
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -365,6 +365,26 @@ def bearer_token(self, bearer_token: str) -> Self: | |||||||||
|
|
||||||||||
| return self | ||||||||||
|
|
||||||||||
| def client_id(self, client_id: str) -> Self: | ||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To avoid confusion, I suggest that you do not name the function parameter the same as the function itself. I suggest changing the function parameter name to |
||||||||||
| """ | ||||||||||
| Set the value of this query's 'Client ID' header according to User's input. | ||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
|
||||||||||
| If an empty parameter is given, default is set to be | ||||||||||
| python_cmr-vX.Y.Z, where X.Y.Z is the version of python_cmr. | ||||||||||
| Otherwise, set the specified paramter option to the value along with | ||||||||||
| the suffix (python_cmr-vX.Y.Z) and a space character between the specified paramter and the suffix. | ||||||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
|
||||||||||
| :param client_id | ||||||||||
| :returns self | ||||||||||
| """ | ||||||||||
|
|
||||||||||
| if not client_id: | ||||||||||
| self.headers.update({"Client-Id: python_cmr-v0.13.0"}) | ||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
|
||||||||||
| self.headers.update({"Client-Id": f"{client_id} python_cmr-v0.13.0"}) | ||||||||||
|
|
||||||||||
| return self | ||||||||||
|
|
||||||||||
| def option( | ||||||||||
| self, parameter: str, key: str, value: Union[str, bool, int, float, None] | ||||||||||
| ) -> Self: | ||||||||||
|
|
||||||||||
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.
Should be able to use https://docs.python.org/3/library/importlib.metadata.html#importlib.metadata.version to dynamically replace the version of
python_cmrin use instead of hard-coding it in the string.