Fix PyPI regex and switch Bicep modules to /api/bicep-modules endpoint
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user