File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -289,8 +289,8 @@ def export_labels(self,
289289 Args:
290290 download (bool): Returns the url if False
291291 timeout_seconds (float): Max waiting time, in seconds.
292- start (str): Earliest date for labels, formatted "YYYY-MM-DD"
293- end (str): Latest date for labels, formatted "YYYY-MM-DD"
292+ start (str): Earliest date for labels, formatted "YYYY-MM-DD" or "YYYY-MM-DD hh:mm:ss"
293+ end (str): Latest date for labels, formatted "YYYY-MM-DD" or "YYYY-MM-DD hh:mm:ss"
294294 Returns:
295295 URL of the data file with this Project's labels. If the server didn't
296296 generate during the `timeout_seconds` period, None is returned.
@@ -311,12 +311,21 @@ def _string_from_dict(dictionary: dict, value_with_quotes=False) -> str:
311311
312312 def _validate_datetime (string_date : str ) -> bool :
313313 """helper function validate that datetime is as follows: YYYY-MM-DD for the export"""
314+ succeed = False
314315 if string_date :
315316 try :
316317 datetime .strptime (string_date , "%Y-%m-%d" )
318+ succeed = True
317319 except ValueError :
318- raise ValueError (f"""Incorrect format for: { string_date } .
319- Format must be \" YYYY-MM-DD\" """ )
320+ pass
321+ try :
322+ datetime .strptime (string_date , "%Y-%m-%d %H:%M:%S" )
323+ succeed = True
324+ except ValueError :
325+ pass
326+ if not succeed :
327+ raise ValueError (f"""Incorrect format for: { string_date } .
328+ Format must be \" YYYY-MM-DD\" or \" YYYY-MM-DD hh:mm:ss\" """ )
320329 return True
321330
322331 sleep_time = 2
You can’t perform that action at this time.
0 commit comments