Skip to content

Fix MAV (Malvern Hills) scraper#435

Open
symroe wants to merge 1 commit into
masterfrom
fix/MAV-scraper
Open

Fix MAV (Malvern Hills) scraper#435
symroe wants to merge 1 commit into
masterfrom
fix/MAV-scraper

Conversation

@symroe

@symroe symroe commented Jul 15, 2026

Copy link
Copy Markdown
Member

What broke

moderngov.malvernhills.gov.uk only serves its ModGov endpoint over HTTPS, but metadata.json pointed base_url at http://. When wreq sends a GET to the HTTP URL it receives an HTTP 301 redirect body (<h1>Object Moved</h1>…) rather than the ModGov XML — wreq does not follow cross-protocol redirects. The framework parses this HTML as XML, finds no <councillor> elements, and raises ValueError: Not many councillors found (0). The HTTPS endpoint is fully operational: GET https://moderngov.malvernhills.gov.uk/mgWebService.asmx/GetCouncillorsByWard returns valid councillor XML with 31 councillors.

What was fixed

  • metadata.json: changed base_url from http://moderngov.malvernhills.gov.uk to https://moderngov.malvernhills.gov.uk

Scrape results

Verified from the live HTTPS endpoint:

Metric Count
Councillors found 31
With email address 29
With photo 31

Generated by Claude Code

…ov.uk

The scraper was hitting http://moderngov.malvernhills.gov.uk which returns
an HTTP 301 redirect to HTTPS. wreq does not follow cross-protocol redirects,
so it received the redirect body (HTML "Document Moved" page) instead of the
ModGov XML, resulting in 0 councillors found. The HTTPS endpoint is fully
operational — confirmed: GET returns valid XML (31 councillors, 29 with email,
31 with photo).
@symroe

symroe commented Jul 15, 2026

Copy link
Copy Markdown
Member Author

Re-scrape after cbabd42

Changed base_url from http:// to https:// in metadata.json. The HTTPS endpoint at https://moderngov.malvernhills.gov.uk/mgWebService.asmx/GetCouncillorsByWard returns valid councillor XML.

Metric Count
Councillors found 31
With email address 29
With photo 31

2 councillors have no email address in the XML. All 31 have <photobigurl> populated.


Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant