import aiohttp


async def coords(system: str):
    """Obtains the coordinates of any system from EDSM. Returns dict with cords, or None if there is any error."""
    try:
        async with aiohttp.ClientSession() as session:
            async with session.get(f"https://www.edsm.net/api-v1/systems?systemName={system}&coords=1") as response:
                coordinates = await response.json()
        if coordinates != "[]":
            return coordinates[0]["coords"]
        else:
            return None
    except Exception:
        return None