From c720dcc68b451d379b1b4bcd0b1a1ec72ed62471 Mon Sep 17 00:00:00 2001 From: Sharvin-M Date: Tue, 14 Jan 2025 12:58:26 -0800 Subject: [PATCH] added client id method --- cmr/queries.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/cmr/queries.py b/cmr/queries.py index cdf9f2e..2dcc928 100644 --- a/cmr/queries.py +++ b/cmr/queries.py @@ -365,6 +365,26 @@ def bearer_token(self, bearer_token: str) -> Self: return self + def client_id(self, client_id: str) -> Self: + """ + Set the value of this query's 'Client ID' header according to User's input. + + 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. + + :param client_id + :returns self + """ + + if not client_id: + self.headers.update({"Client-Id: python_cmr-v0.13.0"}) + + 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: