Fix PyPI regex and switch Bicep modules to /api/bicep-modules endpoint
Some checks failed
Build and Deploy iLSP / test (push) Successful in 7s
Build and Deploy iLSP / build-and-deploy (push) Failing after 25s

catalog.py: Fix HTML parsing regex — pypi-server.i80.dk uses relative hrefs
  like href="pkg-name/" not /simple/pkg-name/. Use simpler <a> text extractor.
modules.py: Replace /call-tool POST (wrong) with GET /api/bicep-modules (new REST
  endpoint added to DevOpsMCP). Simpler, no MCP protocol overhead.
This commit is contained in:
Henrik Jess Nielsen
2026-05-10 12:48:13 +02:00
parent 1a594c78c3
commit c550a4963e
2 changed files with 14 additions and 13 deletions

View File

@@ -64,16 +64,18 @@ class PypiCatalog:
resp.raise_for_status()
html = await resp.text()
# Parse simple index HTML — each <a href="/simple/pkg-name/"> pkg-name </a>
# Parse simple index HTML — each <a href="pkg-name/">pkg-name</a><br>
# The pypi-server.i80.dk simple index uses relative hrefs: href="pkg-name/"
import re
for match in re.finditer(r'href="[^"]+/([^/]+)/"[^>]*>([^<]+)<', html):
pkg_name = match.group(2).strip()
packages.append({
"name": pkg_name,
"label": pkg_name,
"detail": f"i80 package — pypi-server.i80.dk",
"sort_prefix": "0_i80_", # sorts before standard packages
})
for match in re.finditer(r'<a\s+href="[^"]*">([^<]+)</a>', html):
pkg_name = match.group(1).strip()
if pkg_name:
packages.append({
"name": pkg_name,
"label": pkg_name,
"detail": "i80 package — pypi-server.i80.dk",
"sort_prefix": "0_i80_", # sorts before standard packages
})
return packages