feat: continue roadmap acceptance work
This commit is contained in:
@@ -320,15 +320,17 @@ def main(argv: list[str] | None = None) -> int:
|
||||
# Single atomic check-and-reserve before network I/O: failed attempts count toward the limit too.
|
||||
check_and_reserve(site_key, state_file=args.state_file)
|
||||
html = fetch_html(url)
|
||||
records = (
|
||||
parsed = (
|
||||
parse(html, source_url=url)
|
||||
if args.source in DETAIL_SOURCES or args.source == "rf4db-waterbodies"
|
||||
else parse(html)
|
||||
)[:args.limit]
|
||||
)
|
||||
records = parsed if args.source in DETAIL_SOURCES else parsed[:args.limit]
|
||||
except Exception as exc:
|
||||
print(f"community source failed: {exc}", file=sys.stderr)
|
||||
return 1
|
||||
print(json.dumps([asdict(item) for item in records], ensure_ascii=False, default=str))
|
||||
payload = asdict(records) if args.source in DETAIL_SOURCES else [asdict(item) for item in records]
|
||||
print(json.dumps(payload, ensure_ascii=False, default=str))
|
||||
return 0
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user