context.dev package requires Python 3.9 or later. SDKs covers the API key and the defaults all SDKs share.
Install
Create a virtual environment, then install the SDK:Scrape a page
Save this asscrape.py and run python scrape.py. It prints the page as Markdown, starting with # Example Domain.
scrape.py
Look up a brand
Replace the request and theprint line with this lookup. It prints the company name.
Notes
- Methods and parameters use
snake_case. Nested parameters are dictionaries withsnake_casekeys, such asshared_params={"main_content_only": True}. - Set
timeoutin seconds andmax_retrieson the client:ContextDev(timeout=120.0, max_retries=0). AsyncContextDevhas the same methods forasynciocode.