1- <!-- Begin Title, generated by Fern -->
21# Webflow Python Library
32
43[ ![ fern shield] ( https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen )] ( https://github.com/fern-api/fern )
54
6- The Webflow Python Library provides convenient access to the Webflow API from applications written in Python.
7- <!-- End Title -->
5+ The Webflow Python Library provides convenient access to the Webflow API from
6+ applications written in Python. The library includes type definitions for all
7+ request and response fields, and offers both synchronous and asynchronous clients powered by httpx.
88
9- <!-- Begin Installation, generated by Fern -->
10- # Installation
9+ ## Documentation
1110
12- ``` sh
13- pip install --upgrade webflow
11+ API reference documentation is available [ here] ( https://docs.metriport.com/home/welcome ) .
12+
13+ ## Installation
14+
15+ Add this dependency to your project's build file:
16+
17+ ``` bash
18+ pip install webflow
19+ # or
20+ poetry add webflow
1421```
15- <!-- End Installation -->
1622
17- <!-- Begin Usage, generated by Fern -->
18- # Usage
23+ ## Usage
24+ Simply import ` Webflow ` and start making calls to our API.
1925
2026``` python
2127from webflow.client import Webflow
2228
23- client = Webflow(
24- access_token = " YOUR_ACCESS_TOKEN" ,
25- )
29+ client = Webflow(access_token = " YOUR_ACCESS_TOKEN" )
30+ site = client.sites.get(" site-id" )
2631```
27- <!-- End Usage -->
2832
29- <!-- Begin Async Usage, generated by Fern -->
30- # Async Client
33+ ## Async Client
34+ The SDK also exports an async client so that you can make non-blocking
35+ calls to our API.
3136
3237``` python
3338from webflow.client import AsyncWebflow
3439
3540client = AsyncWebflow(
3641 access_token = " YOUR_ACCESS_TOKEN" ,
3742)
43+
44+ async def main () -> None :
45+ site = await client.sites.get(" site-id" )
46+ print (" Received site" , site)
47+
48+ asyncio.run(main())
3849```
39- <!-- End Async Usage -->
4050
41- <!-- Begin Status, generated by Fern -->
42- # Beta Status
51+ ## Webflow Module
52+ All of the models are nested within the Webflow module. Let Intellisense
53+ guide you!
54+
55+ ![ Alt text] ( assets/module.png )
56+
57+ ## Exception Handling
58+ All errors thrown by the SDK will be sublcasses of [ ` ApiError ` ] ( ./src/webflow/core/api_error.py ) .
59+
60+ ``` python
61+ import webflow
62+
63+ try :
64+ client.sites.get(... )
65+ except webflow.core.ApiError as e: # Handle all errors
66+ print (e.status_code)
67+ print (e.body)
68+ except webflow.BadRequestError as e: # Handle specific error
69+ print (e.status_code)
70+ print (e.body)
71+ ```
72+
73+ ## Advanced
74+
75+ ### Timeouts
76+ By default requests time out after 60 seconds. You can configure this with a
77+ timeout option, which accepts a float.
78+
79+ ``` python
80+ from webflow.client import Webflow
81+
82+ client = Webflow(
83+ # 20 seconds
84+ timeout = 20.0 ,
85+ )
86+ ```
87+
88+ ### Custom HTTP client
89+ You can override the httpx client to customize it for your use case. Some common usecases
90+ include support for proxies and transports.
91+
92+ ``` python
93+ import httpx
94+
95+ from webflow.client import Webflow
96+
97+ client = Webflow(
98+ http_client = httpx.Client(
99+ proxies = " http://my.test.proxy.example.com" ,
100+ transport = httpx.HTTPTransport(local_address = " 0.0.0.0" ),
101+ ),
102+ )
103+ ```
104+
105+ ## Beta Status
43106
44107This SDK is in beta, and there may be breaking changes between versions without a major
45108version update. Therefore, we recommend pinning the package version to a specific version.
46109This way, you can install the same version each time without breaking changes.
47- <!-- End Status -->
48110
49- <!-- Begin Contributing, generated by Fern -->
50- # Contributing
111+ ## Contributing
51112
52113While we value open-source contributions to this SDK, this library is generated programmatically.
53114Additions made directly to this library would have to be moved over to our generation code,
@@ -56,5 +117,3 @@ otherwise they would be overwritten upon the next generated release. Feel free t
56117an issue first to discuss with us!
57118
58119On the other hand, contributions to the README are always very welcome!
59- <!-- End Contributing -->
60-
0 commit comments