1- # Context Dev Python API library
1+ # Context.dev Python SDK API library
22
33<!-- prettier-ignore -->
44[ ![ PyPI version] ( https://img.shields.io/pypi/v/context.dev.svg?label=pypi%20(stable) )] ( https://pypi.org/project/context.dev/ )
55
6- The Context Dev Python library provides convenient access to the Context Dev REST API from any Python 3.9+
6+ The Context.dev Python SDK library provides convenient access to the Context Dev REST API from any Python 3.9+
77application. The library includes type definitions for all request params and response fields,
88and offers both synchronous and asynchronous clients powered by [ httpx] ( https://github.com/encode/httpx ) .
99
@@ -32,11 +32,11 @@ client = ContextDev(
3232 api_key = os.environ.get(" CONTEXT_DEV_API_KEY" ), # This is the default and can be omitted
3333)
3434
35- brand = client.brand.retrieve (
36- domain = " REPLACE_ME " ,
37- type = " by_domain " ,
35+ page = client.web.scrape (
36+ formats = { " markdown " : True } ,
37+ url = " https://example.com " ,
3838)
39- print (brand .request_id)
39+ print (page .request_id)
4040```
4141
4242While you can provide an ` api_key ` keyword argument,
@@ -59,11 +59,11 @@ client = AsyncContextDev(
5959
6060
6161async def main () -> None :
62- brand = await client.brand.retrieve (
63- domain = " REPLACE_ME " ,
64- type = " by_domain " ,
62+ page = await client.web.scrape (
63+ formats = { " markdown " : True } ,
64+ url = " https://example.com " ,
6565 )
66- print (brand .request_id)
66+ print (page .request_id)
6767
6868
6969asyncio.run(main())
@@ -96,11 +96,11 @@ async def main() -> None:
9696 api_key = os.environ.get(" CONTEXT_DEV_API_KEY" ), # This is the default and can be omitted
9797 http_client = DefaultAioHttpClient(),
9898 ) as client:
99- brand = await client.brand.retrieve (
100- domain = " REPLACE_ME " ,
101- type = " by_domain " ,
99+ page = await client.web.scrape (
100+ formats = { " markdown " : True } ,
101+ url = " https://example.com " ,
102102 )
103- print (brand .request_id)
103+ print (page .request_id)
104104
105105
106106asyncio.run(main())
@@ -124,12 +124,11 @@ from context.dev import ContextDev
124124
125125client = ContextDev()
126126
127- brand = client.brand.retrieve(
128- domain = " xxx" ,
129- type = " by_domain" ,
130- timeout_opts = {" milliseconds" : 1000 },
127+ response = client.web.scrape(
128+ formats = {" markdown" : True },
129+ url = " https://example.com" ,
131130)
132- print (brand.timeout_opts )
131+ print (response.formats )
133132```
134133
135134## Handling errors
0 commit comments