File tree Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Expand file tree Collapse file tree 1 file changed +8
-15
lines changed Original file line number Diff line number Diff line change @@ -311,22 +311,15 @@ 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
315314 if string_date :
316- try :
317- datetime .strptime (string_date , "%Y-%m-%d" )
318- succeed = True
319- except ValueError :
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\" """ )
329- return True
315+ for fmt in ("%Y-%m-%d" , "%Y-%m-%d %H:%M:%S" ):
316+ try :
317+ datetime .strptime (string_date , fmt )
318+ return
319+ except ValueError :
320+ pass
321+ raise ValueError (f"""Incorrect format for: { string_date } .
322+ Format must be \" YYYY-MM-DD\" or \" YYYY-MM-DD hh:mm:ss\" """ )
330323
331324 sleep_time = 2
332325 id_param = "projectId"
You can’t perform that action at this time.
0 commit comments