Skip to content

Commit

Permalink
WY: hotfix for dates, until api stablizes (#5016)
Browse files Browse the repository at this point in the history
  • Loading branch information
showerst authored Aug 28, 2024
1 parent 0e0d03f commit 0aa7e22
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions scrapers/wy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import requests
import re
from openstates.scrape import State
from .bills import WYBillScraper
from .events import WYEventScraper
Expand Down Expand Up @@ -158,15 +156,4 @@ class Wyoming(State):
]

def get_session_list(self):
# the sessions list is a JS object buried in a massive file
# it looks like:
# .constant("YEAR_VALUES",[{year:2001,title:"General Session",isActive:!0}, ...
session = requests.Session()
js = session.get("http://wyoleg.gov/js/site.min.js").content.decode("utf-8")
# seriously, there must be a better way to do this
sessions_regex = r"constant\(\"YEAR_VALUES\",\[(.*)\)}\(\),function\(w"
sessions_string = re.search(sessions_regex, js, re.DOTALL)
# once we have the big string, pull out year:2001, etc
year_regex = r"year\:(\d+)"
years = re.findall(year_regex, sessions_string.groups(0)[0])
return years
return [str(x) for x in range(2011, 2025)]

0 comments on commit 0aa7e22

Please sign in to comment.