Код: Выделить всё
try:
with urllib.request.urlopen(api_url) as response:
data=json.loads(response.read().decode())
print(json.dumps(data, indent = 4 ))
except Exception as e :
print(f"error reading data : {e} ")
return {"statuscode":"500","body":"Error fetching data"}
games_messages = [game_format(game) for game in data]
"errorMessage": "Объект 'NoneType' не повторяется",
"errorType": "TypeError",
"requestId": "11a9a46e-3abe-4f6e-8c38-278c0697238a",
"stackTrace": [
" Файл "/var/task/lambda_function.py", строка 69, в лямбда_handler\n games_messages = [game_format(game) для игры в данных]\n",
" Файл "/var /task/lambda_function.py", строка 15, в game_format\n Quarter_scores = ', '.join([f"Q{q['Number']}: {q.get('AwayScore', 'N/A')}-{q.get('HomeScore', 'N/A')}" для q в четвертях])\n"
]
данные, которые я получил:
введите здесь описание изображения
Подробнее здесь: https://stackoverflow.com/questions/793 ... t-iterable