diff --git a/openstates/tn/__init__.py b/openstates/tn/__init__.py index b914f1f4ab..0448a979f1 100644 --- a/openstates/tn/__init__.py +++ b/openstates/tn/__init__.py @@ -27,7 +27,7 @@ 'start_year': 2011, 'end_year': 2012}, {'name': '108', 'sessions': ['108'], 'start_year': 2013, 'end_year': 2014}, - {'name': '109', 'sessions': ['109'], + {'name': '109', 'sessions': ['109','109s1','109s2'], 'start_year': 2015, 'end_year': 2016}, {'name': '110', 'sessions': ['110'], 'start_year': 2016, 'end_year': 2017}, @@ -38,6 +38,18 @@ 'display_name': '110th Regular Session (2016-2017)', '_scraped_name': '110th General Assembly', 'start_date': datetime.date(2017, 1, 10)}, + '109s2': { + 'type': 'special', + 'start_date': datetime.date(2016, 9, 12), + 'end_date': datetime.date(2016, 9, 14), + 'display_name': '109th Second Extraordinary Session (September 2016)', + '_scraped_name': '2nd Extraordinary Session (September 2016)'}, + '109s1': { + 'type': 'special', + 'start_date': datetime.date(2016, 2, 1), + 'end_date': datetime.date(2016, 2, 29), + 'display_name': '109th First Extraordinary Session (February 2016)', + '_scraped_name': '1st Extraordinary Session (February 2015)'}, '109': { 'type': 'primary', 'display_name': '109th Regular Session (2015-2016)', diff --git a/openstates/tn/bills.py b/openstates/tn/bills.py index 176796441e..5bbc1bab43 100644 --- a/openstates/tn/bills.py +++ b/openstates/tn/bills.py @@ -192,16 +192,24 @@ class TNBillScraper(BillScraper): def scrape(self, term, chambers): #The index page gives us links to the paginated bill pages - index_page = 'http://wapp.capitol.tn.gov/apps/indexes/' + if self.metadata['session_details'][term]['type'] == 'special': + index_page = 'http://wapp.capitol.tn.gov/apps/indexes/SPSession1.aspx' + xpath = '//h4[text()="%s"]/following-sibling::table[1]/tbody/tr/td/a' % self.metadata['session_details'][term]['_scraped_name'] + else: + index_page = 'http://wapp.capitol.tn.gov/apps/indexes/' + xpath = '//td[contains(@class,"webindex")]/a' + index_list_page = self.get(index_page).text + index_list_page = lxml.html.fromstring(index_list_page) index_list_page.make_links_absolute(index_page) - - for bill_listing in index_list_page.xpath('//td[contains(@class,"webindex")]/a'): - + + for bill_listing in index_list_page.xpath(xpath): + bill_listing = bill_listing.attrib['href'] bill_list_page = self.get(bill_listing).text + bill_list_page = lxml.html.fromstring(bill_list_page) bill_list_page.make_links_absolute(bill_listing)