Return the first non-empty capture group for a regex search.
(pattern: str, text: str)
| 595 | network and understand the implication. |
| 596 | """ |
| 597 | if str(os.environ.get("PAPERFLOW_ALLOW_PRIVATE_FETCH", "")).strip().lower() in {"1", "true", "yes", "on"}: |
| 598 | return |
| 599 | |
| 600 | parts = urlsplit(url) |
| 601 | if parts.scheme not in {"http", "https"}: |
| 602 | raise ValueError(f"unsupported URL scheme for fetching: {parts.scheme or '(none)'}") |
| 603 | |
| 604 | hostname = parts.hostname |
| 605 | if not hostname: |
| 606 | raise ValueError("URL has no host to fetch") |
| 607 | |
| 608 | try: |
no outgoing calls
no test coverage detected