Skip to content
This repository was archived by the owner on Nov 16, 2023. It is now read-only.
This repository was archived by the owner on Nov 16, 2023. It is now read-only.

APAPIKeyException: AP API key is not set. #318

Description

@actongorton

API Key is being set but not passed.

Example:

e = api.Election(
electiondate='2016-11-08', datafile=None, testresults=False, liveresults=True, is_test=False,
api_key={api_key_as_string}
)
raw_races = e.get_raw_races()
race_objs = e.get_race_objects(raw_races)

Other classes work:

ballot_measures = e.ballot_measures
candidate_reporting_units = e.candidate_reporting_units
candidates = e.candidates
races = e.races
reporting_units = e.reporting_units
results = e.results

Stack Trace:

---------------------------------------------------------------------------
APAPIKeyException Traceback (most recent call last)
<ipython-input-17-4946a8f26018> in <module>()
----> 1 raw_races = e.get_raw_races()
2 race_objs = e.get_race_objects(raw_races)
~/venv-science/lib/python3.6/site-packages/elex/api/models.py in get_raw_races(self, **params)
963 return payload
964 else:
--> 965 payload = self.get(self.electiondate, **params)
966 return payload
967 ~/venv-science/lib/python3.6/site-packages/elex/api/models.py in get(self, path, **params)
904 A dict of optional parameters to be included in API request.
905 """
--> 906 self._response = utils.api_request('/elections/{0}'.format(path), **params)
907 return self._response.json()
908 ~/venv-science/lib/python3.6/site-packages/elex/api/utils.py in api_request(path, **params)
92 93 if not params['apiKey']:
---> 94 raise APAPIKeyException()
95 96 params['format'] = 'json'
APAPIKeyException: AP API key is not set.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions