Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async def update_results():
async with aiohttp.ClientSession() as session:
understat = Understat(session)
results = await understat.get_league_results("EPL", 2019)
for result in results:
result["h"]["title"] = understat_team_converter(result["h"]["title"])
result["a"]["title"] = understat_team_converter(result["a"]["title"])
requests = [ReplaceOne({"id": result["id"]}, result, upsert=True)
for result in results]
database.results.bulk_write(requests)