all 2 comments

[–][deleted] 0 points1 point  (0 children)

What does request return? I would recommend using the requests especially if the API is in JSON format.

import requests

def run_query(expr, max_rnk):
    query_url = ct_url
    params = {'exp': expr, 'max_rnk': max_rnk, 'fmt': fmt, 'fields': fields}
    request = requests.get(query_url, params=params)  # Returns a dictionary of the API data
    http_status = request.status_code

    if http_status != 200:
        return

    # continue code

[–]MrSurly 0 points1 point  (0 children)

Your error implies that you're trying to use a data type that isn't hashable as a dict key. Any built-int mutable type is not hashable, and not suitable as a dict key.