1 from boto3.dynamodb.conditions import Key
3 def find_puzzle_for_url(turb, hunt_id, url):
4 """Given a hunt_id and URL, return the puzzle with that URL
6 Returns None if no puzzle with the given URL exists in the database,
7 otherwise a dictionary with all fields from the puzzle's row in
11 response = turb.table.query(
12 IndexName='url_index',
13 KeyConditionExpression=(
14 Key('hunt_id').eq(hunt_id) &
19 if response['Count'] == 0:
22 return response['Items'][0]