Python Flickr API函数问题

Python Flickr API函数问题,python,api,flickr,Python,Api,Flickr,我对Flickr的以下API请求有问题。My函数将10个照片ID的列表作为输入。然而,当我从我的函数中打印数据时,我只获得了基于1个照片ID的信息。查看我下面的函数,是否了解是什么导致仅打印1个照片ID的内容?任何帮助都会很好 for item in get_flickr_data(word)["photos"]["photo"]: photo_ids =item["id"].encode('utf-8') lst_photo_ids.append(photo_ids) pri

我对Flickr的以下API请求有问题。My函数将10个照片ID的列表作为输入。然而,当我从我的函数中打印数据时,我只获得了基于1个照片ID的信息。查看我下面的函数,是否了解是什么导致仅打印1个照片ID的内容?任何帮助都会很好

for item in get_flickr_data(word)["photos"]["photo"]:
    photo_ids =item["id"].encode('utf-8')
    lst_photo_ids.append(photo_ids)

print lst_photo_ids 

lst_photo_ids = ['34117701526', '33347528313', '34158745075', '33315997274', '33315996984', '34028007021', '33315995844', '33347512113', '33315784134', '34024299271']

def get_photo_data(lst_photo_ids):
        baseurl = "https://api.flickr.com/services/rest/"
        params_d = {}
        params_d["method"] = "flickr.photos.getInfo"
        params_d["format"] = "json"
        params_d["photo_id"] = photo_ids
        params_d["api_key"] = FLICKR_KEY
        unique_identifier = params_unique_combination(baseurl,params_d)
        if unique_identifier in CACHE_DICTION:
            flickr_data_diction = CACHE_DICTION[unique_identifier]
        else:
            resp = requests.get(baseurl,params_d)
            json_result_text = resp.text[14:-1]
            flickr_data_diction = json.loads(json_result_text)
            CACHE_DICTION[unique_identifier] = flickr_data_diction
            fileref = open(CACHE_FNAME,"w")
            fileref.write(json.dumps(CACHE_DICTION))
            fileref.close()
        return flickr_data_diction
print get_photo_data(photo_ids)

整理变量名。。。在全局范围内有
lst\u photo\u id
,然后将不存在的
photo\u id
传递给函数,函数将其放入
lst\u photo\u id
参数中。。。然后在函数中使用全局变量
photo\u id
。@Rawing感谢我之前的代码中存在反馈photo\u id,我做了一个编辑,在我的原始帖子中显示了它。