security(polymarket-browse): replace bare except: with specific exception handling
- Lines 386, 400: except: changed to except (ValueError, TypeError): - ValueError: datetime.fromisoformat parse failure - TypeError: input is not a string - Prevents swallowing KeyboardInterrupt, SystemExit, MemoryError
This commit is contained in:
@@ -383,7 +383,7 @@ def is_tradeable_event(e: dict[str, Any]) -> bool:
|
|||||||
now = datetime.now(timezone.utc)
|
now = datetime.now(timezone.utc)
|
||||||
if end_dt < now:
|
if end_dt < now:
|
||||||
return False
|
return False
|
||||||
except:
|
except (ValueError, TypeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# Filter: match has already started (startTime is in the past)
|
# Filter: match has already started (startTime is in the past)
|
||||||
@@ -397,7 +397,7 @@ def is_tradeable_event(e: dict[str, Any]) -> bool:
|
|||||||
hours_ago = (now - start_dt).total_seconds() / 3600
|
hours_ago = (now - start_dt).total_seconds() / 3600
|
||||||
if hours_ago > 4:
|
if hours_ago > 4:
|
||||||
return False
|
return False
|
||||||
except:
|
except (ValueError, TypeError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user