No HTTP error but empty requested text using invalid password
Hi, trying the lib for the first time, and following the docs example, I'm unable to obtain a token.
Is there something I need to configure on the THEIA side ?
I modified the code to debug this txt
variable and it's empty, even thought the request succeeded.
Edit: false alarm !
I had to update my password (seems everyone did).
So not a real issue, but still a weird behaviour when auth failed.
INFO:theia-picker:Renew token
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
File ~/.local/lib/python3.10/site-packages/theia_picker/download.py:207, in RequestsManager.renew_authorization_headers(self)
206 try:
--> 207 uuid.UUID(txt)
208 except ValueError as err:
File /usr/lib/python3.10/uuid.py:177, in UUID.__init__(self, hex, bytes, bytes_le, fields, int, version, is_safe)
176 if len(hex) != 32:
--> 177 raise ValueError('badly formed hexadecimal UUID string')
178 int = int_(hex, 16)
ValueError: badly formed hexadecimal UUID string
The above exception was the direct cause of the following exception:
InvalidToken Traceback (most recent call last)
Cell In[1], line 3
1 from theia_picker import TheiaCatalog
----> 3 theia = TheiaCatalog("/home/vidlb/.config/theia_credentials.json")
4 features = theia.search(
5 start_date="01/01/2017",
6 end_date="01/01/2023",
7 bbox=[4.01, 42.99, 4.9, 44.05],
8 level="LEVEL2A"
9 )
File ~/.local/lib/python3.10/site-packages/theia_picker/download.py:738, in TheiaCatalog.__init__(self, config_file_json, max_records)
736 with open(config_file_json, encoding='UTF-8') as json_file:
737 credentials = json.load(json_file)
--> 738 self._requests_mgr = RequestsManager(credentials=credentials)
740 self.max_records = max_records
File ~/.local/lib/python3.10/site-packages/theia_picker/download.py:186, in RequestsManager.__init__(self, credentials)
183 self.sess.mount('https://', HTTPAdapter(max_retries=retries))
185 self.authorization_headers = {}
--> 186 self.renew_authorization_headers()
File ~/.local/lib/python3.10/site-packages/theia_picker/download.py:209, in RequestsManager.renew_authorization_headers(self)
207 uuid.UUID(txt)
208 except ValueError as err:
--> 209 raise InvalidToken(
210 "Unable to get a valid token. "
211 "Maybe check your credentials?"
212 ) from err
214 self.authorization_headers = {
215 "Authorization": f"Bearer {txt}",
216 "Content-Type": "application/json"
217 }
InvalidToken: Unable to get a valid token. Maybe check your credentials?