Skip to content

Commit

Permalink
fix for include parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesturk committed Jan 5, 2022
1 parent cd8fb05 commit 8ce5762
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/pyopenstates/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
if ENVIRON_API_KEY:
session.headers.update({"X-Api-Key": ENVIRON_API_KEY})
else:
print(f"Warning: No API Key found, set {API_KEY_ENV_VAR}")
warnings.warn(f"Warning: No API Key found, set {API_KEY_ENV_VAR}")


class APIError(RuntimeError):
Expand Down Expand Up @@ -80,9 +80,6 @@ def _convert(result):
return result

url = f"{API_ROOT}/{uri}"
for param in params.keys():
if isinstance(params[param], list):
params[param] = ",".join(params[param])
response = session.get(url, params=params)
if response.status_code != 200:
if response.status_code == 404:
Expand Down
14 changes: 14 additions & 0 deletions tests/test_pyopenstates.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,20 @@ def testBillDetails():
assert bill["identifier"] == bill_id


def test_get_bill_includes():
state = "nc"
session = "2019"
bill_id = "HB 1105"

bill = pyopenstates.get_bill(
state=state, session=session, bill_id=bill_id, include=["sources", "versions"]
)

assert bill["identifier"] == bill_id
assert bill["versions"]
assert bill["sources"]


def testBillDetailsByUID():
"""Bill details by UID"""
_id = "6dc08e5d-3d62-42c0-831d-11487110c800"
Expand Down

0 comments on commit 8ce5762

Please sign in to comment.