there is an issue in line 50, the year passed for querying the api is not the argument but the content of data['date']