Python Heroku:TypeError:字符串索引必须是整数

Python Heroku:TypeError:字符串索引必须是整数,python,heroku,Python,Heroku,当我在本地运行脚本时,没有错误,但在Heroku上,它返回: TypeError:字符串索引必须是整数 (错误行标记在代码中)您的功能是否以任何方式更改url\u列表?听起来好像是在某个地方,url\u列表[i][url\u data]值被更改为字符串。@Logan Rowe函数hh、superjob、habr\u job不更改url\u列表。 url_list = [ {'city': 1, 'language': 2, 'url_data': {'hh': 'https://hh.ru/se

当我在本地运行脚本时,没有错误,但在Heroku上,它返回:

TypeError:字符串索引必须是整数


(错误行标记在代码中)

您的功能是否以任何方式更改
url\u列表
?听起来好像是在某个地方,
url\u列表[i][url\u data]
值被更改为字符串。@Logan Rowe函数hh、superjob、habr\u job不更改url\u列表。
url_list = [
{'city': 1, 'language': 2, 'url_data': {'hh': 'https://hh.ru/search/vacancyarea=1&fromSearchLine=true&st=searchVacancy&text=JavaScript', 'superjob': 'https://www.superjob.ru/vacancy/search/?keywords=JavaScript&geo%5Bt%5D%5B0%5D=4', 'habr_job': 'https://career.habr.com/vacancies?city_id=678&q=JavaScript&type=all'}},
{'city': 1, 'language': 3, 'url_data': {'hh': 'https://hh.ru/search/vacancy?clusters=true&area=1&enable_snippets=true&salary=&st=searchVacancy&text=Java&customDomain=1', 'superjob': 'https://www.superjob.ru/vacancy/search/?keywords=Java&geo%5Bt%5D%5B0%5D=4&click_from=facet', 'habr_job': 'https://career.habr.com/vacancies?city_id=678&q=Java&type=all'}}, 
{'city': 1, 'language': 1, 'url_data': {'hh': 'https://hh.ru/search/vacancy?area=1&fromSearchLine=true&st=searchVacancy&text=Python&from=suggest_post', 'superjob': 'https://www.superjob.ru/vacancy/search/?keywords=Python&geo%5Bt%5D%5B0%5D=4', 'habr_job': 'https://career.habr.com/vacancies?city_id=678&page=1&skills[]=446&type=all'}}
]

parsers = (
    (hh, 'hh'),
    (superjob, 'superjob'),
    (habr_job, 'habr_job')
)

jobs, errors = [], []

for data in url_list:
    for func, key in parsers:
        url = data['url_data'][key] # --> Error in this line of code.
        j, e = func(url, city=data['city'], language=data['language'])
        jobs += j
        errors += e