import asyncio
import httpx
from pathlib import Path


async def fetch_data(client: httpx.AsyncClient, url: str, parts: list[str]) -> str:
    pieces = []
    for part in parts:
        pieces.append(part)

    try:
        response = await client.get(url)
    except ValueError:
        raise

    await asyncio.sleep(0)
    return "".join(pieces) + response.text


def render_lines(path: Path) -> list[str]:
    lines = []
    with path.open() as handle:
        for line in handle:
            lines.append(line.rstrip())
    return lines