Official Python client for expand.ai.
Use the Python SDK when application code needs Fetch.
pip install expandaiuv add expandaipoetry add expandaifetch() returns Markdown.
from expandai import Expand, FetchParams
client = Expand(api_key="{{API_KEY}}")
markdown = client.fetch(FetchParams(url="https://example.com"))
print(markdown)from expandai import BatchedParams, Expand
client = Expand(api_key="{{API_KEY}}")
run = client.batched(BatchedParams(urls=["https://example.com", "https://example.com/about"]))
status = client.get_batched(run.id)
print(status.results)import asyncio
from expandai import AsyncExpand, FetchParams
async def main() -> None:
async with AsyncExpand(api_key="{{API_KEY}}") as client:
markdown = await client.fetch(FetchParams(url="https://example.com"))
print(markdown)
asyncio.run(main())