Skip to content

Commit

Permalink
Added type-checking on advanced qualifications.
Browse files Browse the repository at this point in the history
  • Loading branch information
evankirkiles committed Apr 12, 2021
1 parent 2a0d510 commit 03d075c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions psiturk/amt_services_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,12 @@ def _generate_hit_config(self, ad_url, num_workers, reward, duration, require_qu
if advanced_quals_path:
with open(advanced_quals_path) as f:
advanced_qualifications = json.load(f)
if not isinstance(advanced_qualifications, list):
raise PsiturkException(message=f'JSON file "{advanced_quals_path}" must be a list of dicts')
else:
for el in advanced_qualifications:
if not isinstance(el, dict):
raise PsiturkException(message=f'JSON file "{advanced_quals_path}" must be a list of dicts')

hit_config = {
"ad_location": ad_url,
Expand Down

0 comments on commit 03d075c

Please sign in to comment.