@@ -27,7 +27,7 @@ poetry add webflow
2727Simply import ` Webflow ` and start making calls to our API.
2828
2929``` python
30- from webflow.client import Webflow
30+ from webflow import Webflow
3131
3232client = Webflow(
3333 access_token = " YOUR_ACCESS_TOKEN"
@@ -40,7 +40,8 @@ The SDK also exports an async client so that you can make non-blocking
4040calls to our API.
4141
4242``` python
43- from webflow.client import AsyncWebflow
43+ import asyncio
44+ from webflow import AsyncWebflow
4445
4546client = AsyncWebflow(
4647 access_token = " YOUR_ACCESS_TOKEN"
@@ -95,7 +96,7 @@ access_token = get_access_token(
9596Instantiate the client using your ` access_token ` .
9697
9798``` python
98- from webflow.client import Webflow
99+ from webflow import Webflow
99100
100101client = Webflow(
101102 access_token = access_token
@@ -112,14 +113,17 @@ guide you!
112113All errors thrown by the SDK will be subclasses of [ ` ApiError ` ] ( ./src/webflow/core/api_error.py ) .
113114
114115``` python
115- import webflow
116+ from webflow import Webflow, BadRequestError
117+ from webflow.core.api_error import ApiError
118+
119+ client = Webflow(access_token = " YOUR_ACCESS_TOKEN" )
116120
117121try :
118- client.sites.get(... )
119- except webflow.core.ApiError as e: # Handle all errors
122+ client.sites.get(" site-id " )
123+ except BadRequestError as e: # Handle specific error
120124 print (e.status_code)
121125 print (e.body)
122- except webflow.BadRequestError as e: # Handle specific error
126+ except ApiError as e: # Handle all API errors
123127 print (e.status_code)
124128 print (e.body)
125129```
@@ -131,25 +135,25 @@ By default, requests time out after 60 seconds. You can configure this with a
131135timeout option, which accepts a float.
132136
133137``` python
134- from webflow.client import Webflow
138+ from webflow import Webflow
135139
136140client = Webflow(
137- # 20 seconds
138- timeout = 20.0 ,
141+ access_token = " YOUR_ACCESS_TOKEN " ,
142+ timeout = 20.0 , # 20 seconds
139143)
140144```
141145
142146### Custom HTTP client
143147You can override the httpx client to customize it for your use-case. Some common use-cases
144- include support for proxies and transports.
148+ include support for proxies, transports, or custom base URLs .
145149
146150``` python
147151import httpx
148-
149- from webflow.client import Webflow
152+ from webflow import Webflow
150153
151154client = Webflow(
152- http_client = httpx.Client(
155+ access_token = " YOUR_ACCESS_TOKEN" ,
156+ httpx_client = httpx.Client(
153157 proxies = " http://my.test.proxy.example.com" ,
154158 transport = httpx.HTTPTransport(local_address = " 0.0.0.0" ),
155159 ),
0 commit comments