Skip to content

Commit

Permalink
Merge pull request openstates#1136 from loandy/hotfix/pa
Browse files Browse the repository at this point in the history
PA: Updated metadata formatting and fixed minor session issue.
  • Loading branch information
Andy Lo authored Jul 20, 2016
2 parents 3f56a29 + 297d8a0 commit d7a0a15
Showing 1 changed file with 70 additions and 55 deletions.
125 changes: 70 additions & 55 deletions openstates/pa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,66 +5,79 @@
from .committees import PACommitteeScraper
from .events import PAEventScraper

settings = dict(SCRAPELIB_RPM=30)
settings = {'SCRAPELIB_RPM': 30}

metadata = dict(
name='Pennsylvania',
abbreviation='pa',
capitol_timezone='America/New_York',
legislature_name='Pennsylvania General Assembly',
legislature_url='http://www.legis.state.pa.us/',
chambers = {
metadata = {
'name': 'Pennsylvania',
'abbreviation': 'pa',
'legislature_name': 'Pennsylvania General Assembly',
'legislature_url': 'http://www.legis.state.pa.us/',
'capitol_timezone': 'America/New_York',
'chambers': {
'upper': {'name': 'Senate', 'title': 'Senator'},
'lower': {'name': 'House', 'title': 'Representative'},
},
terms=[
dict(name='2009-2010', start_year=2009,
end_year=2010,
sessions=[
'2009-2010',
'2009-2010 Special Session #1 (Transportation)']),
dict(name='2011-2012', start_year=2011,
end_year=2012,
sessions=[
'2011-2012']),
dict(name='2013-2014', start_year=2013,
end_year=2014,
sessions=[
'2013-2014']),
dict(name='2015-2016', start_year=2015,
end_year=2016,
sessions=[
'2015-2016']),
],
session_details={
'2009-2010': {'type': 'primary',
'display_name': '2009-2010 Regular Session',
'_scraped_name': '2009-2010 Regular Session',
},
'terms': [
{
'name': '2009-2010',
'start_year': 2009,
'end_year': 2010,
'sessions': [
'2009-2010',
'2009-2010 Special Session #1 (Transportation)'
],
},
{
'name': '2011-2012',
'start_year': 2011,
'end_year': 2012,
'sessions': ['2011-2012']
},
{
'name': '2013-2014',
'start_year': 2013,
'end_year': 2014,
'sessions': ['2013-2014']
},
{
'name': '2015-2016',
'start_year': 2015,
'end_year': 2016,
'sessions': ['2015-2016']
},
],
'session_details': {
'2009-2010': {
'type': 'primary',
'display_name': '2009-2010 Regular Session',
'_scraped_name': '2009-2010 Regular Session',
},
'2009-2010 Special Session #1 (Transportation)': {
'type': 'special',
'display_name': '2009-2010, 1st Special Session',
'_scraped_name': '2009-2010 Special Session #1 (Transportation)',
},
'2011-2012': {'type': 'primary',
'display_name': '2011-2012 Regular Session',
'_scraped_name': '2011-2012 Regular Session',
},
'2013-2014': {'type': 'primary',
'display_name': '2013-2014 Regular Session',
'_scraped_name': '2013-2014 Regular Session',
},
'2015-2016': {'type': 'primary',
'display_name': '2015-2016 Regular Session',
'_scraped_name': '2015-2016 Regular Session',
},
'2011-2012': {
'type': 'primary',
'display_name': '2011-2012 Regular Session',
'_scraped_name': '2011-2012 Regular Session',
},
feature_flags=['events', 'influenceexplorer'],
_ignored_scraped_sessions=[
'2013-2014': {
'type': 'primary',
'display_name': '2013-2014 Regular Session',
'_scraped_name': '2013-2014 Regular Session',
},
'2015-2016': {
'type': 'primary',
'display_name': '2015-2016 Regular Session',
'_scraped_name': '2015-2016 Regular Session',
},
},
'_ignored_scraped_sessions': [
'1969-1970 Regular Session',
'1971-1972 Regular Session',
'1971-1972 Special Session #1 ',
'1971-1972 Special Session #2 ',
'1971-1972 Special Session #1',
'1971-1972 Special Session #2',
'1973-1974 Regular Session',
'1975-1976 Regular Session',
'1977-1978 Regular Session',
Expand All @@ -73,32 +86,34 @@
'1983-1984 Regular Session',
'1985-1986 Regular Session',
'1987-1988 Regular Session',
'1987-1988 Special Session #1 ',
'1987-1988 Special Session #1',
'1989-1990 Regular Session',
'1991-1992 Regular Session',
'1991-1992 Special Session #1 ',
'1991-1992 Special Session #1',
'1993-1994 Regular Session',
'1995-1996 Regular Session',
'1995-1996 Special Session #1 ',
'1995-1996 Special Session #2 ',
'1995-1996 Special Session #1',
'1995-1996 Special Session #2',
'1997-1998 Regular Session',
'1999-2000 Regular Session',
'2001-2002 Regular Session',
'2001-2002 Special Session #1 ',
'2001-2002 Special Session #1',
'2003-2004 Regular Session',
'2005-2006 Regular Session',
'2005-2006 Special Session #1 (taxpayer relief act)',
'2007-2008 Regular Session',
'2007-2008 Special Session #1 (Energy Policy)',
]
)
],
'feature_flags': ['events', 'influenceexplorer'],
}


def session_list():
from billy.scrape.utils import url_xpath
return url_xpath('http://www.legis.state.pa.us/cfdocs/legis/home/bills/',
'//select[@id="billSessions"]/option/text()')


def extract_text(doc, data):
if doc['mimetype'] in (None, 'text/html'):
doc = lxml.html.fromstring(data)
Expand Down

0 comments on commit d7a0a15

Please sign in to comment.