Skip to content

Commit

Permalink
Handle missing results field from FR
Browse files Browse the repository at this point in the history
The Federal Register API used to return `results: []` when there were no results, but now it just doesn't include the `results` key at all. This handles the change.
  • Loading branch information
Mr0grog committed Jan 28, 2025
1 parent cca4bb1 commit be3e590
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rule_scout.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def get_recent_proposed_rules(self, from_date: date | None = None, to_date: date
}
while next_options:
page = self.get(**next_options).raise_for_status().json()
yield from page['results']
yield from page.get('results') or []

next_url = page.get('next_page_url')
next_options = {'url': next_url} if next_url else None
Expand Down

0 comments on commit be3e590

Please sign in to comment.