(country: str)
| 596 | |
| 597 | |
| 598 | def get_bad_proxy_map(country: str) -> dict: |
| 599 | key = country.upper() |
| 600 | state = load_proxy_state() |
| 601 | bucket = state.get(key, {}) if isinstance(state.get(key, {}), dict) else {} |
| 602 | now = int(time.time()) |
| 603 | cleaned = {proxy: int(expiry) for proxy, expiry in bucket.items() if int(expiry) > now} |
| 604 | if cleaned != bucket: |
| 605 | if cleaned: |
| 606 | state[key] = cleaned |
| 607 | elif key in state: |
| 608 | del state[key] |
| 609 | save_proxy_state(state) |
| 610 | return cleaned |
| 611 | |
| 612 | |
| 613 | def mark_proxy_bad(country: str, proxy: str, ttl: int = BAD_PROXY_TTL) -> None: |
no test coverage detected