MCPcopy Create free account
hub / github.com/StarsTom/mobileCodexHelper / parse_nginx_timestamp

Function parse_nginx_timestamp

mobile_codex_control.py:350–370  ·  view source on GitHub ↗
(value: str)

Source from the content-addressed store, hash-verified

348
349
350def parse_nginx_timestamp(value: str) -> str | None:
351 match = re.match(
352 r"^(?P<day>\d{2})/(?P<month>[A-Za-z]{3})/(?P<year>\d{4}):"
353 r"(?P<hour>\d{2}):(?P<minute>\d{2}):(?P<second>\d{2}) (?P<offset>[+-]\d{4})$",
354 value,
355 )
356 if not match:
357 return None
358 month = NGINX_MONTHS.get(match.group("month"))
359 if month is None:
360 return None
361 offset = match.group("offset")
362 iso = (
363 f"{match.group('year')}-{month:02d}-{match.group('day')}T"
364 f"{match.group('hour')}:{match.group('minute')}:{match.group('second')}"
365 f"{offset[:3]}:{offset[3:]}"
366 )
367 try:
368 return datetime.fromisoformat(iso).isoformat()
369 except ValueError:
370 return None
371
372
373def get_listener_map(ports: list[int] | None = None) -> dict[int, ListenerInfo]:

Callers 1

recent_mobile_requestsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected