import re
import datetime
import lxml.html

metadata = dict(
    name='Oregon',
    abbreviation='or',
    capitol_timezone='America/Los_Angeles',
    legislature_name='Oregon Legislative Assembly',
    legislature_url='http://www.leg.state.or.us/',
    chambers = {
        'upper': {'name': 'Senate', 'title': 'Senator'},
        'lower': {'name': 'House', 'title': 'Representative'},
    },
    terms=[
        {'name': '2007-2008',
         'sessions': ['2007 Regular Session',
                      '2008 Special Session' ],
         'start_year': 2007, 'end_year': 2008},
        {'name': '2009-2010',
         'sessions': ['2009 Regular Session',
                      '2010 Special Session' ],
         'start_year': 2009, 'end_year': 2010},
        {'name': '2011-2012',
         'sessions': ['2011 Regular Session',
                      '2012 Regular Session',
                      '2012 Special Session' ],
         'start_year': 2011, 'end_year': 2012},
        {'name': '2013-2014',
         'sessions': ['2013 Regular Session',
                      '2013 Special Session',
                      '2014 Regular Session'],
         'start_year': 2013, 'end_year': 2014},
        {'name': '2015-2016',
         'sessions': ['2015 Regular Session',
                      '2016 Regular Session',],
         'start_year': 2015, 'end_year': 2016},
        {'name': '2017-2018',
         'sessions': ['2017 Regular Session',
                      '2018 Regular Session'],
         'start_year': 2017, 'end_year': 2018},
    ],
    session_details={
        '2007 Regular Session': {
            'display_name': '2007 Regular Session',
            '_scraped_name': '2007 Regular Session',
            'slug': '2007 Regular Session',
        },
        '2008 Special Session': {
            'display_name': '2008 Special Session',
            '_scraped_name': '2008 Special Session',
            'slug': '2008 Special Session',
        },
        '2009 Regular Session': {
            'display_name': '2009 Regular Session',
            '_scraped_name': '2009 Regular Session',
            'slug': '2009 Regular Session',
        },
        '2010 Special Session': {
            'display_name': '2010 Special Session',
            '_scraped_name': '2010 Special Session',
            'slug': '2010 Special Session',
        },
        '2011 Regular Session': {
            'display_name': '2011 Regular Session',
            '_scraped_name': '2011 Regular Session',
            'slug': '2011 Regular Session',
        },
        '2012 Regular Session': {
            'display_name': '2012 Regular Session',
            '_scraped_name': '2012 Regular Session',
            'slug': '2012 Regular Session',
        },
        '2012 Special Session' : {
            'display_name': '2012 Speical Session',
            '_scraped_name': '2012 Special Session',
            'slug': '2012 Special Session',
        },
        '2013 Regular Session': {
            'display_name': '2013 Regular Session',
            '_scraped_name': '2013 Regular Session',
            'slug': '2013 Regular Session',
        },
        '2013 Special Session': {
            'display_name': '2013 Special Session',
            '_scraped_name': '2013 Special Session',
            'slug': '2013 Special Session',
        },
        '2014 Regular Session': {
            'display_name': '2014 Regular Session',
            '_scraped_name': '2014 Regular Session',
            'slug': '2014 Regular Session',
        },
        '2015 Regular Session': {
            'display_name': '2015 Regular Session',
            '_scraped_name': '2015 Regular Session',
            'slug': '2015 Regular Session',
        },
        '2016 Regular Session': {
            'display_name': '2016 Regular Session',
            '_scraped_name': '2016 Regular Session',
            'slug': '2016 Regular Session',
        },
        '2017 Regular Session': {
            'display_name': '2017 Regular Session',
            '_scraped_name': '2017 Regular Session',
            'slug': '2017 Regular Session',
            'start_date': datetime.date(2017, 2, 1),
            'end_date': datetime.date(2017, 7, 10),
        },
        '2018 Regular Session': {
            'display_name': '2018 Regular Session',
            '_scraped_name': '2018 Regular Session',
            'slug': '2018 Regular Session',
        },
        '2018 Special Session': {
            'display_name': '2018 Special Session',
            '_scraped_name': '2018 1st Special Session',
            'slug': '2018 Special Session',
        },
    },
    _ignored_scraped_sessions=['Today',
                               '2015-2016 Interim',
                               '2013 1st Special Session',
                               '2012 1st Special Session',
                               '2013 - 2014 Interim',
                               '2011 - 2012 Interim',
                               '2009 - 2010 Interim',
                               '2007 - 2008 Interim'],
    feature_flags=[],
)

billy_metadata/or.py
import re
import datetime
import lxml.html

metadata = dict(
    name='Oregon',
    abbreviation='or',
    capitol_timezone='America/Los_Angeles',
    legislature_name='Oregon Legislative Assembly',
    legislature_url='http://www.leg.state.or.us/',
    chambers = {
        'upper': {'name': 'Senate', 'title': 'Senator'},
        'lower': {'name': 'House', 'title': 'Representative'},
    },
    terms=[
        {'name': '2007-2008',
         'sessions': ['2007 Regular Session',
                      '2008 Special Session' ],
         'start_year': 2007, 'end_year': 2008},
        {'name': '2009-2010',
         'sessions': ['2009 Regular Session',
                      '2010 Special Session' ],
         'start_year': 2009, 'end_year': 2010},
        {'name': '2011-2012',
         'sessions': ['2011 Regular Session',
                      '2012 Regular Session',
                      '2012 Special Session' ],
         'start_year': 2011, 'end_year': 2012},
        {'name': '2013-2014',
         'sessions': ['2013 Regular Session',
                      '2013 Special Session',
                      '2014 Regular Session'],
         'start_year': 2013, 'end_year': 2014},
        {'name': '2015-2016',
         'sessions': ['2015 Regular Session',
                      '2016 Regular Session',],
         'start_year': 2015, 'end_year': 2016},
        {'name': '2017-2018',
         'sessions': ['2017 Regular Session',
                      '2018 Regular Session',
                      '2018 Special Session',],
         'start_year': 2017, 'end_year': 2018},
    ],
    session_details={
        '2007 Regular Session': {
            'display_name': '2007 Regular Session',
            '_scraped_name': '2007 Regular Session',
            'slug': '2007 Regular Session',
        },
        '2008 Special Session': {
            'display_name': '2008 Special Session',
            '_scraped_name': '2008 Special Session',
            'slug': '2008 Special Session',
        },
        '2009 Regular Session': {
            'display_name': '2009 Regular Session',
            '_scraped_name': '2009 Regular Session',
            'slug': '2009 Regular Session',
        },
        '2010 Special Session': {
            'display_name': '2010 Special Session',
            '_scraped_name': '2010 Special Session',
            'slug': '2010 Special Session',
        },
        '2011 Regular Session': {
            'display_name': '2011 Regular Session',
            '_scraped_name': '2011 Regular Session',
            'slug': '2011 Regular Session',
        },
        '2012 Regular Session': {
            'display_name': '2012 Regular Session',
            '_scraped_name': '2012 Regular Session',
            'slug': '2012 Regular Session',
        },
        '2012 Special Session' : {
            'display_name': '2012 Speical Session',
            '_scraped_name': '2012 Special Session',
            'slug': '2012 Special Session',
        },
        '2013 Regular Session': {
            'display_name': '2013 Regular Session',
            '_scraped_name': '2013 Regular Session',
            'slug': '2013 Regular Session',
        },
        '2013 Special Session': {
            'display_name': '2013 Special Session',
            '_scraped_name': '2013 Special Session',
            'slug': '2013 Special Session',
        },
        '2014 Regular Session': {
            'display_name': '2014 Regular Session',
            '_scraped_name': '2014 Regular Session',
            'slug': '2014 Regular Session',
        },
        '2015 Regular Session': {
            'display_name': '2015 Regular Session',
            '_scraped_name': '2015 Regular Session',
            'slug': '2015 Regular Session',
        },
        '2016 Regular Session': {
            'display_name': '2016 Regular Session',
            '_scraped_name': '2016 Regular Session',
            'slug': '2016 Regular Session',
        },
        '2017 Regular Session': {
            'display_name': '2017 Regular Session',
            '_scraped_name': '2017 Regular Session',
            'slug': '2017 Regular Session',
            'start_date': datetime.date(2017, 2, 1),
            'end_date': datetime.date(2017, 7, 10),
        },
        '2018 Regular Session': {
            'display_name': '2018 Regular Session',
            '_scraped_name': '2018 Regular Session',
            'slug': '2018 Regular Session',
        },
        '2018 Special Session': {
            'display_name': '2018 Special Session',
            '_scraped_name': '2018 1st Special Session',
            'slug': '2018 Special Session',
        },
    },
    _ignored_scraped_sessions=['Today',
                               '2015-2016 Interim',
                               '2013 1st Special Session',
                               '2012 1st Special Session',
                               '2013 - 2014 Interim',
                               '2011 - 2012 Interim',
                               '2009 - 2010 Interim',
                               '2007 - 2008 Interim'],
    feature_flags=[],
)

billy_metadata/or.py
diff --git a/billy_metadata/or.py b/billy_metadata/or.py
index b245888aaa..542f661bca 100644
--- a/billy_metadata/or.py
+++ b/billy_metadata/or.py
@@ -37,7 +37,8 @@
          'start_year': 2015, 'end_year': 2016},
         {'name': '2017-2018',
          'sessions': ['2017 Regular Session',
-                      '2018 Regular Session'],
+                      '2018 Regular Session',
+                      '2018 Special Session',],
          'start_year': 2017, 'end_year': 2018},
     ],
     session_details={

OR failing since at least 2018-05-19
OR has been failing since 2018-05-19

Based on automated runs it appears that OR has not run successfully in 6 days (2018-05-19).


```
  08:02:19 INFO billy: Save person Julie Fahey
08:02:19 INFO billy: Save person Tim Knopp
08:02:19 INFO billy: Save person Laurie Monnes Anderson
08:02:19 INFO billy: Save person Ginny Burdick
08:02:19 INFO billy: Save person Betsy Johnson
08:02:19 INFO billy: Save person Cedric Hayden
08:02:19 INFO billy: Save person Brad Witt
08:02:19 INFO billy: Save person Alissa Keny-Guyer
08:02:19 INFO billy: Save person Diego Hernandez
08:02:19 INFO billy: Save person Margaret Doherty
08:02:19 INFO billy: Save committee Sole Proprietors
08:02:19 INFO billy: Save bill lower 2018 Special Session: HB4301
08:02:19 WARNING billy: Value u'2018 Special Session' for field '<obj>.session' is not in the enumeration: ['2007 Regular Session', '2008 Special Session', '2009 Regular Session', '2010 Special Session', '2011 Regular Session', '2012 Regular Session', '2012 Special Session', '2013 Regular Session', '2013 Special Session', '2014 Regular Session', '2015 Regular Session', '2016 Regular Session', '2017 Regular Session', '2018 Regular Session']
08:02:19 INFO billy: Save bill lower 2018 Special Session: HCR301
08:02:19 WARNING billy: Value u'2018 Special Session' for field '<obj>.session' is not in the enumeration: ['2007 Regular Session', '2008 Special Session', '2009 Regular Session', '2010 Special Session', '2011 Regular Session', '2012 Regular Session', '2012 Special Session', '2013 Regular Session', '2013 Special Session', '2014 Regular Session', '2015 Regular Session', '2016 Regular Session', '2017 Regular Session', '2018 Regular Session']
08:02:19 INFO billy: Save vote 2018 Special Session upper: HCR 301 'Rules suspended. Final reading.  Carried by Steiner Hayward.  Adopted.'
08:02:19 WARNING billy: Value u'2018 Special Session' for field '<obj>.session' is not in the enumeration: ['2007 Regular Session', '2008 Special Session', '2009 Regular Session', '2010 Special Session', '2011 Regular Session', '2012 Regular Session', '2012 Special Session', '2013 Regular Session', '2013 Special Session', '2014 Regular Session', '2015 Regular Session', '2016 Regular Session', '2017 Regular Session', '2018 Regular Session']
08:02:19 INFO billy: Save vote 2018 Special Session lower: HB 4301 'Rules suspended. Third reading. Carried by Barnhart. Passed.'
08:02:19 WARNING billy: Value u'2018 Special Session' for field '<obj>.session' is not in the enumeration: ['2007 Regular Session', '2008 Special Session', '2009 Regular Session', '2010 Special Session', '2011 Regular Session', '2012 Regular Session', '2012 Special Session', '2013 Regular Session', '2013 Special Session', '2014 Regular Session', '2015 Regular Session', '2016 Regular Session', '2017 Regular Session', '2018 Regular Session']
08:02:19 INFO billy: Save vote 2018 Special Session upper: HB 4301 'Expands availability of elective reduced personal income tax rate for certain pass-through income to taxpayers doing business as sole proprietors.'
08:02:19 WARNING billy: Value u'2018 Special Session' for field '<obj>.session' is not in the enumeration: ['2007 Regular Session', '2008 Special Session', '2009 Regular Session', '2010 Special Session', '2011 Regular Session', '2012 Regular Session', '2012 Special Session', '2013 Regular Session', '2013 Special Session', '2014 Regular Session', '2015 Regular Session', '2016 Regular Session', '2017 Regular Session', '2018 Regular Session']
08:02:19 INFO billy: Save vote 2018 Special Session upper: HCR 301 'Adjourns sine die 2018 special session of Seventy-ninth Legislative Assembly.'
08:02:19 WARNING billy: Value u'2018 Special Session' for field '<obj>.session' is not in the enumeration: ['2007 Regular Session', '2008 Special Session', '2009 Regular Session', '2010 Special Session', '2011 Regular Session', '2012 Regular Session', '2012 Special Session', '2013 Regular Session', '2013 Special Session', '2014 Regular Session', '2015 Regular Session', '2016 Regular Session', '2017 Regular Session', '2018 Regular Session']
08:02:19 INFO billy: Save vote 2018 Special Session lower: HCR 301 'Rules suspended. Read. Carried by Williamson. Adopted.'
08:02:19 WARNING billy: Value u'2018 Special Session' for field '<obj>.session' is not in the enumeration: ['2007 Regular Session', '2008 Special Session', '2009 Regular Session', '2010 Special Session', '2011 Regular Session', '2012 Regular Session', '2012 Special Session', '2013 Regular Session', '2013 Special Session', '2014 Regular Session', '2015 Regular Session', '2016 Regular Session', '2017 Regular Session', '2018 Regular Session']
08:02:19 INFO billy: Save vote 2018 Special Session upper: HB 4301 'Rules suspended. Third reading.  Carried by Beyer.  Passed.'
08:02:19 WARNING billy: Value u'2018 Special Session' for field '<obj>.session' is not in the enumeration: ['2007 Regular Session', '2008 Special Session', '2009 Regular Session', '2010 Special Session', '2011 Regular Session', '2012 Regular Session', '2012 Special Session', '2013 Regular Session', '2013 Special Session', '2014 Regular Session', '2015 Regular Session', '2016 Regular Session', '2017 Regular Session', '2018 Regular Session']
08:02:21 INFO billy: billy-update abbr=or
    actions=import,report
    types=bills,legislators,votes,committees,alldata
    sessions=2018 Regular Session
    terms=2017-2018
08:02:21 INFO billy: Finished importing 90 legislator files.
08:02:21 INFO billy: imported 6 vote files
Traceback (most recent call last):
  File "/opt/openstates/venv-billy//bin/billy-update", line 11, in <module>
    load_entry_point('billy', 'console_scripts', 'billy-update')()
  File "/opt/openstates/venv-billy/src/billy/billy/bin/update.py", line 413, in main
    import_report = _do_imports(abbrev, args)
  File "/opt/openstates/venv-billy/src/billy/billy/bin/update.py", line 152, in _do_imports
    report['bills'] = import_bills(abbrev, settings.BILLY_DATA_DIR)
  File "/opt/openstates/venv-billy/src/billy/billy/importers/bills.py", line 413, in import_bills
    ret = import_bill(data, votes, categorizer)
  File "/opt/openstates/venv-billy/src/billy/billy/importers/bills.py", line 231, in import_bill
    match_sponsor_ids(abbr, data)
  File "/opt/openstates/venv-billy/src/billy/billy/importers/bills.py", line 37, in match_sponsor_ids
    sponsor['name'])
  File "/opt/openstates/venv-billy/src/billy/billy/importers/names.py", line 26, in get_legislator_id
    raise Exception("bad session: " + session)
Exception: bad session: 2018 Special Session
```

Visit http://bobsled.openstates.org for more info.

