diff options
| author | Martin Fischer <martin@push-f.com> | 2025-03-09 13:48:00 +0100 | 
|---|---|---|
| committer | Martin Fischer <martin@push-f.com> | 2025-03-09 21:36:04 +0100 | 
| commit | 232f1499bb9a2cc85a63abcc1c22776ef77781fb (patch) | |
| tree | 50b9b429140e6d597090e5d1264496555fd0edf7 /osm_proposals/archived_without_template.py | |
| parent | 42c737aa1a7731170e8369482f96b557a1bd7a36 (diff) | |
build: introduce NixOS package & service
Diffstat (limited to 'osm_proposals/archived_without_template.py')
| -rwxr-xr-x | osm_proposals/archived_without_template.py | 34 | 
1 files changed, 34 insertions, 0 deletions
| diff --git a/osm_proposals/archived_without_template.py b/osm_proposals/archived_without_template.py new file mode 100755 index 0000000..ea026d3 --- /dev/null +++ b/osm_proposals/archived_without_template.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 +""" +Queries wiki.openstreetmap.org for archived proposal pages without the {{Proposal page}} template. + +Sometimes when archiving a page people accidentally also replace the +{{Proposal page}} template, which however means that proposal.py +won't find the page anymore. This script lists such pages so that the +template can be manually restored. +""" +import argparse + +import pywikiapi +import mwparserfromhell + +OSMWIKI_ENDPOINT = 'https://wiki.openstreetmap.org/w/api.php' + + +def run(): +    arg_parser = argparse.ArgumentParser( +        description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter +    ) +    arg_parser.parse_args() + +    osmwiki = pywikiapi.Site(OSMWIKI_ENDPOINT) + +    for page in osmwiki.query_pages( +        generator='categorymembers', +        gcmtitle='Category:Archived proposals', +        gcmlimit='max', +        prop='templates', +        tltemplates='Template:Proposal page', +    ): +        if not 'templates' in page: +            print(page['title']) | 
