diff options
author | Martin Fischer <martin@push-f.com> | 2025-08-28 06:55:33 +0200 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2025-08-28 07:11:02 +0200 |
commit | 0107738c361b5b74f3193881b7935f2e316d21c8 (patch) | |
tree | 1442fec98a5c431f92765e0eb17b2e49e3d36612 /osm_proposals/proposals.py | |
parent | 0a531bcbd4778ef754583d52d1a6b525ee9702d4 (diff) |
refactor: extract find_proposals function
Diffstat (limited to 'osm_proposals/proposals.py')
-rwxr-xr-x | osm_proposals/proposals.py | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/osm_proposals/proposals.py b/osm_proposals/proposals.py index edcb453..e265fcc 100755 --- a/osm_proposals/proposals.py +++ b/osm_proposals/proposals.py @@ -28,6 +28,15 @@ def run(): arg_parser.add_argument("out_file") args = arg_parser.parse_args() + proposals = find_proposals() + + with open(args.out_file, 'w') as f: + json.dump(proposals, f) + + logger.info(f"updated {args.out_file}") + + +def find_proposals(): res = requests.get( OSMWIKI_ENDPOINT, params=dict( @@ -65,11 +74,7 @@ def run(): proposals.append(proposal) proposals.sort(key=sort_key, reverse=True) - - with open(args.out_file, 'w') as f: - json.dump([{k: v for k, v in p.items() if v is not None} for p in proposals], f) - - logger.info(f"updated {args.out_file}") + return [{k: v for k, v in p.items() if v is not None} for p in proposals] def get_template_val(tpl, name): |