Repository: openstates/openstates-scrapers

Issue:
AZ failing since at least 2019-03-15
AZ has been failing since 2019-03-15

Based on automated runs it appears that AZ has not run successfully in 2 days (2019-03-15).


```
  07:33:48 INFO pupa: Unclassified action: None
07:33:48 INFO pupa: Unclassified action: PFC
07:33:48 INFO scrapelib: GET - https://apps.azleg.gov/api/DocType/?billStatusId=71988
07:33:49 INFO scrapelib: GET - https://apps.azleg.gov/api/BillSponsor/?id=71988
07:33:50 INFO scrapelib: GET - https://apps.azleg.gov/api/Keyword/?billStatusId=71988
07:33:51 INFO scrapelib: GET - https://apps.azleg.gov/api/BillStatusFloorAction
07:33:52 INFO pupa: save vote_event 54th-1st-regular - 2019-02-27 - do pass amended as vote_event_d908967e-47bd-11e9-b40b-02d5eb8e7b22.json
07:33:52 INFO scrapelib: GET - https://apps.azleg.gov/api/BillStatusFloorAction
07:33:53 INFO pupa: save vote_event 54th-1st-regular - 2019-02-27 - Passed as vote_event_d9a4080c-47bd-11e9-b40b-02d5eb8e7b22.json
07:33:53 INFO pupa: save bill SB1352 in 54th-1st-regular as bill_d6a8a306-47bd-11e9-b40b-02d5eb8e7b22.json
07:33:53 INFO scrapelib: GET - https://apps.azleg.gov/api/Bill/?billNumber=SB1353&sessionId=121&legislativeBody=S
07:33:54 INFO pupa: Unclassified action: None
07:33:54 INFO pupa: Unclassified action: None
07:33:54 INFO pupa: Unclassified action: None
07:33:54 INFO pupa: Unclassified action: PFC
07:33:54 INFO scrapelib: GET - https://apps.azleg.gov/api/DocType/?billStatusId=71989
07:33:55 INFO scrapelib: GET - https://apps.azleg.gov/api/BillSponsor/?id=71989
07:33:56 INFO scrapelib: GET - https://apps.azleg.gov/api/Keyword/?billStatusId=71989
07:33:57 INFO scrapelib: GET - https://apps.azleg.gov/api/BillStatusFloorAction
07:33:58 INFO pupa: save vote_event 54th-1st-regular - 2019-02-27 - do pass amended as vote_event_dc9c40c4-47bd-11e9-b40b-02d5eb8e7b22.json
07:33:58 INFO scrapelib: GET - https://apps.azleg.gov/api/BillStatusFloorAction
07:33:59 INFO pupa: save vote_event 54th-1st-regular - 2019-02-28 - Passed as vote_event_dd37c36e-47bd-11e9-b40b-02d5eb8e7b22.json
07:33:59 INFO pupa: save bill SB1353 in 54th-1st-regular as bill_da3e60f0-47bd-11e9-b40b-02d5eb8e7b22.json
07:33:59 INFO scrapelib: GET - https://apps.azleg.gov/api/Bill/?billNumber=SB1354&sessionId=121&legislativeBody=S
07:34:00 INFO pupa: Unclassified action: None
loaded Open States pupa settings...
az (scrape, import)
  bills: {}
Traceback (most recent call last):
  File "/opt/**PGUSER**/venv-pupa//bin/pupa", line 11, in <module>
    load_entry_point('pupa', 'console_scripts', 'pupa')()
  File "/opt/**PGUSER**/venv-pupa/src/pupa/pupa/cli/__main__.py", line 68, in main
    subcommands[args.subcommand].handle(args, other)
  File "/opt/**PGUSER**/venv-pupa/src/pupa/pupa/cli/commands/update.py", line 278, in handle
    return self.do_handle(args, other, juris)
  File "/opt/**PGUSER**/venv-pupa/src/pupa/pupa/cli/commands/update.py", line 327, in do_handle
    report['scrape'] = self.do_scrape(juris, args, scrapers)
  File "/opt/**PGUSER**/venv-pupa/src/pupa/pupa/cli/commands/update.py", line 175, in do_scrape
    report[scraper_name] = scraper.do_scrape(**scrape_args)
  File "/opt/**PGUSER**/venv-pupa/src/pupa/pupa/scrape/base.py", line 112, in do_scrape
    for obj in self.scrape(**kwargs) or []:
  File "/opt/**PGUSER**/**PGUSER**/**PGUSER**/az/bills.py", line 316, in scrape
    yield from self.scrape_bill(chamber, session, bill_id, session_id)
  File "/opt/**PGUSER**/**PGUSER**/**PGUSER**/az/bills.py", line 42, in scrape_bill
    self.scrape_actions(bill, page, chamber)
  File "/opt/**PGUSER**/**PGUSER**/**PGUSER**/az/bills.py", line 134, in scrape_actions
    self.action_from_struct(bill, status)
  File "/opt/**PGUSER**/**PGUSER**/**PGUSER**/az/bills.py", line 209, in action_from_struct
    status['ReportDate'], '%Y-%m-%dT%H:%M:%S').strftime('%Y-%m-%d')
TypeError: strptime() argument 1 must be str, not None
```

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



Discussion:

Resolving patch:
diff --git a/openstates/az/bills.py b/openstates/az/bills.py
--- a/openstates/az/bills.py
+++ b/openstates/az/bills.py
@@ -205,17 +205,20 @@ def action_from_struct(self, bill, status):
             else:
                 raise ValueError(
                     'Unexpected committee type: {}'.format(status['Committee']['TypeName']))
-            action_date = datetime.datetime.strptime(
-                status['ReportDate'], '%Y-%m-%dT%H:%M:%S').strftime('%Y-%m-%d')
-            bill.add_action(
-                description=status['Action'],
-                chamber={
-                    'S': 'upper',
-                    'H': 'lower',
-                }[status['Committee']['LegislativeBody']],
-                date=action_date,
-                classification=categories,
-            )
+            if status['ReportDate']:
+                action_date = datetime.datetime.strptime(
+                    status['ReportDate'], '%Y-%m-%dT%H:%M:%S').strftime('%Y-%m-%d')
+                bill.add_action(
+                    description=status['Action'],
+                    chamber={
+                        'S': 'upper',
+                        'H': 'lower',
+                    }[status['Committee']['LegislativeBody']],
+                    date=action_date,
+                    classification=categories,
+                )
+            else:
+                self.info("Action without report date: {}".format(status['Action']))
         else:
             # most of the unclassified ones are hearings
             # https://www.azleg.gov/faq/abbreviations/


Test patch: