Function Issue with Flickr API


CACHE_FNAME = "cached_data.json"
    filex = open(CACHE_FNAME, 'rb')
    saved_cache = pickle.load(filex)

def params_unique_combination(baseurl, params_d, private_keys=["api_key"]):
    alphabetized_keys = sorted(params_d.keys())
    res = []
    for k in alphabetized_keys:
        if k not in private_keys:
            res.append("{}-{}".format(k, params_d[k]))
    return baseurl + "_".join(res)
def get_flickr_data(search_data,photo_number=50):
    baseurl =""
    params_d["tags"]= search_data
    params_d["format"]= "json"
    params_d["method"]= ""
    params_d["tag_mode"]= "all"
    params_d["api_key"] = FLICKR_KEY
    unique_indent = params_unique_combination(baseurl,params_d)

    if unique_indent in CACHE_DICTION:
        flickr_info = CACHE_DICTION[unique_indent]
        resp = requests.get(baseurl,params_d)
        python_flickr = json.loads(resp.text[14:-1])
        CACHE_DICTION[unique_indent] = python_flickr
        f = open(CACHE_FNAME,"w")
        cache_str_tmp = json.dumps(CACHE_DICTION)
    return CACHE_DICTION

Above is my code, I am having issues with the function "get_flickr_data."I am not receiving a traceback error, the function is just not returning any data. The function should check whether or not the unique identifier for each request exists in your cache data, and if it does, should access the Python object that represents that data from the CACHE_DICTION.If there is no such data in the cache, the function should make a request to the Flickr Photos Search API for photos tagged with your input string. It should modify the string that is returned from the Flickr API so that it is formatted in JSON.The function should add the new dictionary of data to the cache dictionary, associated with the unique identifier key, and should write all the data in the cache dictionary, now with an additional key-value pair, to the cache file. The RETURN VALUE of “get_flickr_data” regardless of whether it got data from the cache or made a new request and saved data to the cache, should be a dictionary representing search data from the Flickr Photos Search API. Any help would be appreciated.


nevermind I figured out the issue, it was jus tin the last 2 lines of code!