diff --git a/scrapers/al/__init__.py b/scrapers/al/__init__.py index 7e8bf628dc..461f64fcd5 100644 --- a/scrapers/al/__init__.py +++ b/scrapers/al/__init__.py @@ -34,16 +34,26 @@ class Alabama(State): "name": "2023 Regular Session", "start_date": "2023-03-07", "end_date": "2023-06-08", + "active": False, + }, + { + "_scraped_name": "Regular Session 2024", + "classification": "primary", + "identifier": "2024rs", + "name": "2024 Regular Session", + "start_date": "2024-02-06", + "end_date": "2024-05-24", "active": True, }, ] ignored_scraped_sessions = [] def get_session_list(self): - return ["Regular Session 2023"] + return ["Regular Session 2023", "Regular Session 2024"] def get_scraper_ids(self, session): ids = { + "2024rs": {"session_year": "2024", "session_type": "2024 Regular Session"}, "2023rs": {"session_year": "2023", "session_type": "2023 Regular Session"}, "2023s1": { "session_year": "2023", diff --git a/scrapers/al/bills.py b/scrapers/al/bills.py index 50c5c918a0..fd0783e621 100644 --- a/scrapers/al/bills.py +++ b/scrapers/al/bills.py @@ -6,7 +6,6 @@ import dateutil import requests from openstates.scrape import Scraper, Bill, VoteEvent -from openstates.exceptions import EmptyScrape from utils.media import get_media_type from .actions import Categorizer @@ -47,7 +46,6 @@ def scrape_bill_type(self, session, bill_type): limit = 10000 # max of 10 pages in case something goes way wrong while offset < 100000: - # WARNING: 2023 session id is currently hardcoded json_data = { "query": f'{{allInstrumentOverviews(instrumentType:"{bill_type}", instrumentNbr:"", body:"", sessionYear:"{self.session_year}", sessionType:"{self.session_type}", assignedCommittee:"", status:"", currentStatus:"", subject:"", instrumentSponsor:"", companionInstrumentNbr:"", effectiveDateCertain:"", effectiveDateOther:"", firstReadSecondBody:"", secondReadSecondBody:"", direction:"ASC"orderBy:"InstrumentNbr"limit:"{limit}"offset:"{offset}" search:"" customFilters: {{}}companionReport:"", ){{ ID,SessionYear,InstrumentNbr,InstrumentUrl, InstrumentSponsor,SessionType,Body,Subject,ShortTitle,AssignedCommittee,PrefiledDate,FirstRead,CurrentStatus,LastAction,ActSummary,ViewEnacted,CompanionInstrumentNbr,EffectiveDateCertain,EffectiveDateOther,InstrumentType,IntroducedUrl,EngrossedUrl,EnrolledUrl }}}}', "operationName": "", @@ -57,7 +55,9 @@ def scrape_bill_type(self, session, bill_type): page = self.post(self.gql_url, headers=self.gql_headers, json=json_data) page = json.loads(page.content) if len(page["data"]["allInstrumentOverviews"]) < 1 and offset == 0: - raise EmptyScrape + # TODO: this fails if one chamber is empty and the other isn't + # raise EmptyScrape + return for row in page["data"]["allInstrumentOverviews"]: chamber = self.chamber_map[row["Body"]]