160-tool MCP server for real-time global intelligence from free public APIs: markets, liquidity, prediction markets, SEC filings, conflict, military, aircraft-cohort early warning, migration and border flows, cyber, climate, news and more. Dated observation history, 29 research prompts, cited briefs, geofences, SSE dashboard. MIT, no paid API keys.
Python ai-toolsai-watchanthropicclaudecybersecuritydashboardgeofencinggeopoliticalgeospatialintelligencemarketsmcpmigrationmilitarymodel-context-protocolnuclearosintreal-timespace-weatherthreat-intelligence
Border crossings: second review round (schema tests, date window, odd paths)
Phoenix Agent (mac-studio)4c4b7c113d27
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 09fb47c..f626fe5 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -51,15 +51,21 @@and cells that cannot be read outside the columns the tool uses arenamed in `data_gaps` instead of failing the file; a CBP row with bytesthat are not UTF-8 in a column the tool reads is counted as unreadable.+ A UK row dated before 1 January 2018 (where SB_01 starts) or more than+ seven days after today is left out and named. A cached copy written+ under an older layout or rule is refetched, never served.- Requests use an identifying User-Agent, two per refresh (the listing,then the file), cached 12 h (CBP) and 3 h (UK). Only https links on the- publishers' own hosts (www.cbp.gov; assets.publishing.service.gov.uk or- www.gov.uk), on the standard port and without credentials, are- requested. CBP's robots.txt rule is checked on the path as normalized- for the request (dot segments removed, escapes of unreserved characters- decoded), so paths it disallows are never requested; a newer-looking CBP- file at such a path is named in `data_gaps` instead, as is any- encounters link the tool cannot read. Redirects are followed, and the+ publishers' own hosts (www.cbp.gov; assets.publishing.service.gov.uk, or+ www.gov.uk under /government/uploads/ since its robots.txt disallows+ other paths), on the standard port, without credentials and with no+ backslash, %5C or empty segment in the path, are requested. CBP's+ robots.txt rule is checked on the path as normalized for the request+ (dot segments removed, escapes of unreserved characters decoded), so+ paths it disallows are never requested; a newer-looking CBP file at such+ a path is named in `data_gaps` instead, as is any encounters link the+ tool cannot read (including names with "_" or a space after+ "nationwide"). Redirects are followed, and thedownload size caps apply after the body is read, both in the sharedfetcher (see the module's gaps).- Frontex is not built: its only data file is an XLSX under `/assets/`,diff --git a/src/world_intel_mcp/sources/border_crossings.py b/src/world_intel_mcp/sources/border_crossings.pyindex 8851464..0924e23 100644--- a/src/world_intel_mcp/sources/border_crossings.py+++ b/src/world_intel_mcp/sources/border_crossings.py@@ -19,7 +19,9 @@ Publishers, as measured on 2026-10-17 (HTTP status, robots.txt, terms):* UK Home Office: "Small boat activity in the English Channel" on GOV.UK, readthrough the GOV.UK Content API (200, keyless, at most 10 requests per secondper client). The time series is published only as an ODS spreadsheet, on- assets.publishing.service.gov.uk (robots.txt 404). ODS is a zip of XML, read+ assets.publishing.service.gov.uk (robots.txt 404); an attachment on+ www.gov.uk is accepted only under /government/uploads/, since its robots.txt+ (200) disallows other paths such as /search/all*. ODS is a zip of XML, readhere with zipfile and the standard library's expat parser, streamed withDTDs refused, so no new dependency. GOV.UK content is under the OpenGovernment Licence v3.0.@@ -109,6 +111,10 @@ def _now() -> str:return datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")+def _today() -> date:+ return datetime.now(timezone.utc).date()++def _usage(source: str, error: str) -> dict[str, Any]:return {"error": error, "source": source, "timestamp": _now()}@@ -236,7 +242,7 @@ _CBP_FILE_NAME = re.compile(_CBP_FILE_FOLDER = re.compile(r"^/sites/default/files/(\d{4}-\d{2})/[^/]+$")# Any encounters CSV link, to name the ones the file-name rule above cannot read; the by-state# files are a different table, read by nothing here, so they are not named.-_CBP_ENCOUNTERS_CSV = re.compile(r"nationwide-encounters[^/]*\.csv$", re.IGNORECASE)+_CBP_ENCOUNTERS_CSV = re.compile(r"nationwide[-_ ]?encounters[^/]*\.csv$", re.IGNORECASE) # matched unquoted_CBP_STATE_CSV = re.compile(r"-state(?:_\d+)?\.csv$", re.IGNORECASE)_UNRESERVED = frozenset(string.ascii_letters + string.digits + "-._~")_ESCAPE = re.compile(r"%([0-9A-Fa-f]{2})")@@ -528,10 +534,18 @@ def _normalized_path(raw_path: str) -> str:return _remove_dot_segments(_ESCAPE.sub(unescape, raw_path))+def _odd_path(raw_path: str) -> bool:+ """A backslash (or %5C) or an empty segment: no publisher's file path has one, and a server+ may read either as a way into another directory (a backslash as "/", "//" merged into "/"),+ which the literal robots.txt prefix match would not see."""+ return "\\" in raw_path or "%5c" in raw_path.lower() or "//" in raw_path++def _cbp_link(href: str) -> tuple[str, str, bool] | None:"""(URL to request, its path, robots.txt allows it) of a link on https://www.cbp.gov, else None.- Only https on the standard port with no credentials is accepted. The URL is rebuilt from+ Only https on the standard port with no credentials, and a path with no backslash, %5C or+ empty segment, is accepted. The URL is rebuilt fromthe normalized path and must come back from httpx with that exact path, so the robots.txtrule is checked on the path httpx sends, not on the link as written: a dot segment or apercent-escape cannot reach the disallowed directory. A path that reaches it only once@@ -542,6 +556,8 @@ def _cbp_link(href: str) -> tuple[str, str, bool] | None:if first.scheme != "https" or first.host != _CBP_HOST or first.port is not None or first.userinfo:return Noneraw_path, _, query = first.raw_path.decode("ascii").partition("?")+ if _odd_path(raw_path):+ return Nonepath = _normalized_path(raw_path)target = path + (f"?{query}" if query else "")url = f"https://{_CBP_HOST}{target}"@@ -585,8 +601,9 @@ def _file_rank(path: str) -> tuple | None:def _skipped_links(page: _PageParser) -> list[str]:"""Encounters CSV links (by-state files aside) that ``_latest_file`` cannot consider: off- https://www.cbp.gov (another host or scheme, a port, credentials), not a URL at all, or- named in a way the file-name rule cannot read (say "-sept-"). Any of them may be newer than+ https://www.cbp.gov (another host or scheme, a port, credentials), an odd path (a backslash+ or an empty segment), not a URL at all, or named in a way the file-name rule cannot read+ (say "-sept-", or "_" or a space between "nationwide" and "encounters"). Any of them may be newer thanthe file read, so the response names them instead of falling back to an older file insilence."""skipped: list[str] = []@@ -595,7 +612,8 @@ def _skipped_links(page: _PageParser) -> list[str]:path = urlsplit(urljoin(CBP_DATASET_PAGE, href.strip())).pathexcept ValueError:path = href.strip() # a link that does not parse is judged by its text- if not _CBP_ENCOUNTERS_CSV.search(path) or _CBP_STATE_CSV.search(path):+ name = unquote(path) # "nationwide%20encounters-..." is judged as it reads+ if not _CBP_ENCOUNTERS_CSV.search(name) or _CBP_STATE_CSV.search(name):continuelink = _cbp_link(href)if link is not None and _file_rank(link[1]) is not None:@@ -933,11 +951,14 @@ UK_PUBLICATION_PATH = "/government/publications/migrants-detected-crossing-the-eUK_PUBLICATION_PAGE = "https://www.gov.uk" + UK_PUBLICATION_PATHUK_CONTENT_API = "https://www.gov.uk/api/content" + UK_PUBLICATION_PATHUK_CACHE_KEY = "border_crossings:uk_small_boats"-_UK_SCHEMA = 1+_UK_SCHEMA = 2 # 2: rows dated outside the series window are left out (an older copy may hold them)_UK_TTL = 10800 # 3 h; its change history shows 72 updates from 1 August to 16 October 2026_UK_API_MAX_BYTES = 8 * 1024 * 1024_UK_ODS_MAX_BYTES = 32 * 1024 * 1024 # the 16 October 2026 file is 76,787 bytes_UK_FILE_HOSTS = {"assets.publishing.service.gov.uk", "www.gov.uk"}+_UK_GOV_UK_FILES = "/government/uploads/" # the only www.gov.uk path read: robots.txt disallows others+_UK_FIRST_DAY = date(2018, 1, 1) # SB_01 starts on 1 January 2018+_UK_DAYS_AHEAD = 7 # a week ending may be dated a few days past today; a later date is not a figure_UK_SHEETS = ("SB_01", "SB_02", "Notes") # the sheets read; any other sheet is skipped unread_ODS_TYPE = "application/vnd.oasis.opendocument.spreadsheet"# Limits for one file, over every sheet read, each checked before anything is expanded; a file@@ -1415,7 +1436,8 @@ def _uk_series(table: list[list[Any] | None], located: tuple[str, int, dict], kegaps.append(f"{sheet} has no {_UK_COLUMN_LABELS[key]!r} column; those figures are null.")used = {columns[key] for key in ("when", *keys)} - {None} # the date and the figuresrecords: dict[str, list[Any]] = {}- undated = unreadable = duplicates = 0+ undated = out_of_range = unreadable = duplicates = 0+ last_day = _today() + timedelta(days=_UK_DAYS_AHEAD)lost_rows = sum(row is None for row in table)# Unreadable cells away from the date and figures (above the data, or in another column, Notes# included: only a text cell can say "Revised") are named, not fatal.@@ -1433,6 +1455,9 @@ def _uk_series(table: list[list[Any] | None], located: tuple[str, int, dict], keif day is None:undated += 1continue+ if not _UK_FIRST_DAY <= day <= last_day:+ out_of_range += 1 # year 1 or 9999 would also break the date arithmetic of every response+ continueif day.isoformat() in records:duplicates += 1continue@@ -1452,6 +1477,9 @@ def _uk_series(table: list[list[Any] | None], located: tuple[str, int, dict], ke"any figures in them are not counted.")if undated:gaps.append(f"{undated} row(s) of {sheet} have no readable date and are not counted.")+ if out_of_range:+ gaps.append(f"{out_of_range} row(s) of {sheet} are dated outside {_UK_FIRST_DAY} to {last_day} and are "+ "not counted.")if unreadable:gaps.append(f"{unreadable} cell(s) of {sheet} are neither a count nor '-' and are read as null.")if duplicates:@@ -1522,13 +1550,19 @@ def _uk_attachment(item: Any) -> dict[str, Any]:if not isinstance(href, str) or not href.strip():raise _SourceError("uk_unexpected_format", "the time-series attachment has no URL")# Checked as httpx parses it, since that is the URL requested: https on the standard port,- # no credentials, a GOV.UK file host and a path to a file.+ # no credentials, a GOV.UK file host and a path to a file (on www.gov.uk, under+ # /government/uploads/ as resolved and as fully decoded, so ".." or "%2F" cannot leave it).try:url = httpx.URL(urljoin("https://www.gov.uk/", href.strip()))+ raw_path = url.raw_path.decode("ascii").partition("?")[0]except (httpx.InvalidURL, ValueError):url = None+ if url is not None:+ path = _normalized_path(raw_path)+ outside = url.host == "www.gov.uk" and not all(+ p.startswith(_UK_GOV_UK_FILES) for p in (path, _remove_dot_segments(unquote(path))))if (url is None or url.scheme != "https" or url.host not in _UK_FILE_HOSTS or url.port is not None- or url.userinfo or url.path in ("", "/")):+ or url.userinfo or url.path in ("", "/") or _odd_path(raw_path) or outside):raise _SourceError("uk_unexpected_format",f"the time-series attachment is not a file on GOV.UK over https ({_shown(href)})")size = chosen.get("file_size")diff --git a/src/world_intel_mcp/tests/test_sources_border_crossings_rereview.py b/src/world_intel_mcp/tests/test_sources_border_crossings_rereview.pynew file mode 100644index 0000000..19c927b--- /dev/null+++ b/src/world_intel_mcp/tests/test_sources_border_crossings_rereview.py@@ -0,0 +1,228 @@+"""Border crossings: fixes from the second review round (RB1 to RB5).++All offline: respx serves the fixtures of ``test_sources_border_crossings``; every+link, date and attachment URL marked "invented" is not from a publisher.++Gaps / not covered:++* How CBP's server resolves "//" or a backslash in a path was not tested (no network);+ such links are refused whatever the server would do.+* GOV.UK attachments are read only from assets.publishing.service.gov.uk in the+ publication checked on 2026-10-17; the www.gov.uk upload rule rests on GOV.UK's+ robots.txt as captured that day.+"""++from __future__ import annotations++import copy+from datetime import date++import httpx+import pytest+import respx++from world_intel_mcp.fetcher import Fetcher+from world_intel_mcp.sources import border_crossings as bc++from .test_sources_border_crossings import (+ _CBP_CSV_URL,+ _CBP_NORTHERN_USBP_AUG,+ _UK_DAILY,+ _UK_ITEM,+ _UK_ODS_URL,+ _UK_WEEKLY,+ _cbp_mock,+ _main_ods,+ _no_sleep,+ _ods,+ _uk_mock,+)+from .test_sources_border_crossings_edges import _with_links++# ---------------------------------------------------------------------------+# RB1, RB2: cached copies of an older schema+# ---------------------------------------------------------------------------++async def test_cbp_cached_copy_in_the_schema_1_shape_is_refetched_and_never_the_fallback(+ fetcher: Fetcher, monkeypatch: pytest.MonkeyPatch) -> None:+ # The shape 457a49f stored: schema 1, no rows_with_bad_bytes_elsewhere, no meta.skipped_links.+ # Read as current, a copy like this would raise KeyError on every call.+ _no_sleep(monkeypatch)+ with _cbp_mock(_CBP_NORTHERN_USBP_AUG):+ await bc.fetch_us_border_encounters(fetcher, region="northern", component="usbp")+ value, _created = fetcher.cache.get_stale_meta(bc.CBP_CACHE_KEY)+ old = copy.deepcopy(value)+ old["schema"] = 1+ del old["rows_with_bad_bytes_elsewhere"]+ del old["meta"]["skipped_links"]+ fetcher.cache.set(bc.CBP_CACHE_KEY, old, ttl_seconds=3600)+ with _cbp_mock(_CBP_NORTHERN_USBP_AUG) as mock:+ fresh = await bc.fetch_us_border_encounters(fetcher, region="northern", component="usbp")+ urls = [str(call.request.url) for call in mock.calls]+ assert urls == [bc.CBP_DATASET_PAGE, _CBP_CSV_URL] # refetched, not served+ assert fresh["latest"]["encounters"] == 563 and fresh["stale"] is False++ fetcher.cache.set(bc.CBP_CACHE_KEY, old, ttl_seconds=-1)+ with respx.mock:+ respx.get(bc.CBP_DATASET_PAGE).mock(return_value=httpx.Response(503))+ result = await bc.fetch_us_border_encounters(fetcher, region="northern", component="usbp")+ assert result["degraded"] is True and result["reason"] == "cbp_fetch_failed" and "latest" not in result+++async def test_uk_cached_copy_of_schema_1_is_refetched_and_never_the_fallback(+ fetcher: Fetcher, monkeypatch: pytest.MonkeyPatch) -> None:+ # A schema-1 copy may hold a row dated year 1, which the response's date arithmetic cannot take.+ _no_sleep(monkeypatch)+ with _uk_mock(_main_ods()):+ await bc.fetch_uk_small_boat_arrivals(fetcher)+ value, _created = fetcher.cache.get_stale_meta(bc.UK_CACHE_KEY)+ old = copy.deepcopy(value)+ old["schema"] = 1+ old["weekly"].insert(0, ["0001-01-03", 5, 1, 0, None, None, False]) # invented+ fetcher.cache.set(bc.UK_CACHE_KEY, old, ttl_seconds=3600)+ with _uk_mock(_main_ods()) as mock:+ fresh = await bc.fetch_uk_small_boat_arrivals(fetcher, weeks=520)+ urls = [str(call.request.url) for call in mock.calls]+ assert urls == [bc.UK_CONTENT_API, _UK_ODS_URL]+ assert fresh["dataset"]["coverage"]["weekly_from"] == "2024-04-28" and len(fresh["weeks"]) == 10++ fetcher.cache.set(bc.UK_CACHE_KEY, old, ttl_seconds=-1)+ with respx.mock:+ respx.get(bc.UK_CONTENT_API).mock(return_value=httpx.Response(503))+ result = await bc.fetch_uk_small_boat_arrivals(fetcher, weeks=520)+ assert result["degraded"] is True and result["reason"] == "uk_fetch_failed" and "latest_day" not in result+++# ---------------------------------------------------------------------------+# RB2: UK dates outside the series+# ---------------------------------------------------------------------------++_WINDOW_GAP = "1 row(s) of {sheet} are dated outside 2018-01-01 to {last} and are not counted."+++async def test_uk_rows_dated_outside_the_series_are_left_out_and_named(+ fetcher: Fetcher, monkeypatch: pytest.MonkeyPatch) -> None:+ # Invented rows: a week ending in year 1 (a blank date exported as a minimum) and a day in 9999.+ monkeypatch.setattr(bc, "_today", lambda: date(2026, 10, 17))+ ods = _ods(_UK_DAILY.splitlines() + ["9999-12-31,5,1,0"], ["0001-01-03,5,1,0,-,-"] + _UK_WEEKLY.splitlines())+ with _uk_mock(ods):+ result = await bc.fetch_uk_small_boat_arrivals(fetcher)+ gaps = [_WINDOW_GAP.format(sheet="SB_01", last="2026-10-24"), _WINDOW_GAP.format(sheet="SB_02", last="2026-10-24")]+ assert result["data_gaps"] == gaps+ assert result["latest_day"]["date"] == "2026-10-15" and result["dataset"]["daily_data_through"] == "2026-10-15"+ assert result["dataset"]["coverage"]["weekly_from"] == "2024-04-28"+ widest = await bc.fetch_uk_small_boat_arrivals(fetcher, weeks=520) # from the cache+ assert len(widest["weeks"]) == 10 and widest["data_gaps"] == gaps+++async def test_uk_weekly_table_with_only_an_out_of_range_week_has_no_weeks(+ fetcher: Fetcher, monkeypatch: pytest.MonkeyPatch) -> None:+ monkeypatch.setattr(bc, "_today", lambda: date(2026, 10, 17))+ with _uk_mock(_ods(_UK_DAILY.splitlines(), ["0001-01-03,5,1,0,-,-"])): # invented+ result = await bc.fetch_uk_small_boat_arrivals(fetcher)+ assert result["latest_week"] is None and result["weeks"] == []+ assert result["data_gaps"] == [_WINDOW_GAP.format(sheet="SB_02", last="2026-10-24")]++[email protected]("today, last_day, gaps", [+ (date(2026, 10, 8), "2026-10-15", []),+ (date(2026, 10, 7), "2026-10-14", [_WINDOW_GAP.format(sheet="SB_01", last="2026-10-14")]),+])+async def test_uk_series_window_ends_seven_days_after_today(+ fetcher: Fetcher, monkeypatch: pytest.MonkeyPatch, today: date, last_day: str, gaps: list[str]) -> None:+ monkeypatch.setattr(bc, "_today", lambda: today)+ with _uk_mock(_main_ods()):+ result = await bc.fetch_uk_small_boat_arrivals(fetcher)+ assert result["latest_day"]["date"] == last_day and result["data_gaps"] == gaps+++def test_today_is_the_utc_date() -> None:+ from datetime import datetime, timezone+ assert bc._today() == datetime.now(timezone.utc).date()+++# ---------------------------------------------------------------------------+# RB3, RB4: CBP links+# ---------------------------------------------------------------------------++_ODD_PATHS = (+ "/sites/default/files/assets//documents/2026-10/nationwide-encounters-fy23-fy26-sep-aor.csv",+ "/sites/default/files/2026-10\\..\\assets\\documents\\2026-10/nationwide-encounters-fy23-fy26-sep-aor.csv",+ "/sites/default/files/2026-10%5C..%5Cassets%5Cdocuments%5C2026-10/nationwide-encounters-fy23-fy26-sep-aor.csv",+ "/sites/default/files/2026-10%5c..%5cassets%5cdocuments%5c2026-10/nationwide-encounters-fy23-fy26-sep-aor.csv",+) # invented++[email protected]("href", _ODD_PATHS)+def test_cbp_paths_with_a_backslash_or_an_empty_segment_are_refused_and_named(href: str) -> None:+ # Each may resolve into the disallowed directory on a server that merges "//" or reads "\"+ # as "/", which the literal robots.txt prefix match does not see.+ assert bc._cbp_link(href) is None+ assert bc._cbp_link("https://www.cbp.gov" + href) is None+ page = _with_links(href)+ latest = bc.latest_cbp_file(page)+ assert latest["url"] == _CBP_CSV_URL and latest["newer_disallowed_url"] is None+ assert bc._skipped_links(bc._parse_page(page)) == [href]+++async def test_cbp_odd_paths_are_never_requested_and_are_named(fetcher: Fetcher) -> None:+ with _cbp_mock(_CBP_NORTHERN_USBP_AUG, page=_with_links(*_ODD_PATHS)) as mock:+ result = await bc.fetch_us_border_encounters(fetcher, region="northern", component="usbp")+ urls = [str(call.request.url) for call in mock.calls]+ assert urls == [bc.CBP_DATASET_PAGE, _CBP_CSV_URL]+ assert result["latest"]["encounters"] == 563+ gap = next(g for g in result["data_gaps"] if "cannot read" in g)+ assert gap.startswith("CBP's dataset page links 4 encounters file(s) this tool cannot read")+++async def test_cbp_encounters_links_with_another_separator_are_named(fetcher: Fetcher) -> None:+ # Invented names: "_" or an encoded space between "nationwide" and "encounters".+ odd = ("/sites/default/files/2026-10/nationwide_encounters-fy23-fy26-sep-aor.csv",+ "/sites/default/files/2026-10/nationwide%20encounters-fy23-fy26-sep-aor.csv")+ assert bc._skipped_links(bc._parse_page(_with_links(*odd))) == ["https://www.cbp.gov" + path for path in odd]+ with _cbp_mock(_CBP_NORTHERN_USBP_AUG, page=_with_links(*odd)):+ result = await bc.fetch_us_border_encounters(fetcher, region="northern", component="usbp")+ assert result["dataset"]["url"] == _CBP_CSV_URL+ gap = next(g for g in result["data_gaps"] if "cannot read" in g)+ assert "2 encounters file(s)" in gap and all("https://www.cbp.gov" + path in gap for path in odd)+++# ---------------------------------------------------------------------------+# RB5: the UK attachment on www.gov.uk+# ---------------------------------------------------------------------------+[email protected]("href", [+ "https://www.gov.uk/search/all.ods", # robots.txt: Disallow: /search/all*+ "https://www.gov.uk/government/print", # robots.txt: Disallow: /*/print$+ "/government/publications/x/time_series.ods", # on www.gov.uk, not an upload+ "https://www.gov.uk/government/uploads/../../search/all.ods",+ "https://www.gov.uk/government/uploads/%2E%2E/%2E%2E/search/all.ods",+ "https://www.gov.uk/government/uploads%2F..%2F..%2Fsearch/all.ods",+ "https://www.gov.uk/government/uploads/x%2F..%2F..%2F..%2Fsearch/all.ods", # leaves only once decoded+ "https://assets.publishing.service.gov.uk/media/x//time_series.ods",+ "https://assets.publishing.service.gov.uk/media/x\\time_series.ods",+ "https://assets.publishing.service.gov.uk/media/x%5Ctime_series.ods",+]) # invented+def test_uk_attachment_on_www_gov_uk_must_be_an_upload(href: str) -> None:+ item = copy.deepcopy(_UK_ITEM)+ item["details"]["attachments"][2]["url"] = href # altered+ with pytest.raises(bc._SourceError, match="^the time-series attachment is not a file on GOV.UK over https"):+ bc._uk_attachment(item)+++async def test_uk_attachment_outside_the_uploads_is_degraded_and_never_requested(fetcher: Fetcher) -> None:+ item = copy.deepcopy(_UK_ITEM)+ item["details"]["attachments"][2]["url"] = "https://www.gov.uk/search/all.ods" # altered+ with respx.mock(assert_all_called=False) as mock:+ mock.get(bc.UK_CONTENT_API).mock(return_value=httpx.Response(200, json=item))+ result = await bc.fetch_uk_small_boat_arrivals(fetcher)+ urls = [str(call.request.url) for call in mock.calls]+ assert urls == [bc.UK_CONTENT_API]+ assert result["degraded"] is True and result["reason"] == "uk_unexpected_format"+++def test_uk_attachment_under_government_uploads_is_accepted() -> None:+ item = copy.deepcopy(_UK_ITEM)+ url = "https://www.gov.uk/government/uploads/system/uploads/attachment_data/file/1/time_series.ods" # invented+ item["details"]["attachments"][2]["url"] = url # altered+ assert bc._uk_attachment(item)["url"] == url