Skip to content

Commit

Permalink
fixed documentation and added error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
mikehikes committed Aug 8, 2022
1 parent febc769 commit 90990c6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ffiec_data_connect/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,10 @@ def collect_data(session: Union[ffiec_connection.FFIECConnection, requests.Sessi
#print("Reporting period: {}".format(reporting_period_ffiec))

# try to convert the rssd_id to an int and raise an error if it fails
rssd_id_int = int(rssd_id)

try:
rssd_id_int = int(rssd_id)
except:
raise ValueError("Invalid RSSD ID. Must be an integer-type string.")

## scope ret outside the if statement
ret = None
Expand Down Expand Up @@ -472,6 +474,9 @@ def collect_filers_submission_date_time(session: Union[ffiec_connection.FFIECCon

ret = client.service.RetrieveFilersSubmissionDateTime(dataSeries="Call", lastUpdateDateTime=since_date_ffiec, reportingPeriodEndDate=reporting_period_datetime_ffiec)

if ret is None:
raise ValueError("No data returned from FFIEC webservice. Check your credentials and date inputs.")

# normalize the output
normalized_ret = [{"rssd":x["ID_RSSD"], "datetime":x["DateTime"]} for x in ret]

Expand Down

0 comments on commit 90990c6

Please sign in to comment.