webflow 0.1.0b1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. webflow-0.1.0b1/PKG-INFO +193 -0
  2. webflow-0.1.0b1/README.md +177 -0
  3. webflow-0.1.0b1/pyproject.toml +22 -0
  4. webflow-0.1.0b1/src/webflow/__init__.py +313 -0
  5. webflow-0.1.0b1/src/webflow/client.py +108 -0
  6. webflow-0.1.0b1/src/webflow/core/__init__.py +17 -0
  7. webflow-0.1.0b1/src/webflow/core/api_error.py +15 -0
  8. webflow-0.1.0b1/src/webflow/core/client_wrapper.py +49 -0
  9. webflow-0.1.0b1/src/webflow/core/datetime_utils.py +28 -0
  10. webflow-0.1.0b1/src/webflow/core/jsonable_encoder.py +103 -0
  11. webflow-0.1.0b1/src/webflow/core/remove_none_from_dict.py +11 -0
  12. webflow-0.1.0b1/src/webflow/environment.py +7 -0
  13. webflow-0.1.0b1/src/webflow/errors/__init__.py +19 -0
  14. webflow-0.1.0b1/src/webflow/errors/bad_request_error.py +10 -0
  15. webflow-0.1.0b1/src/webflow/errors/conflict_error.py +10 -0
  16. webflow-0.1.0b1/src/webflow/errors/forbidden_error.py +10 -0
  17. webflow-0.1.0b1/src/webflow/errors/internal_server_error.py +10 -0
  18. webflow-0.1.0b1/src/webflow/errors/not_found_error.py +10 -0
  19. webflow-0.1.0b1/src/webflow/errors/too_many_requests_error.py +10 -0
  20. webflow-0.1.0b1/src/webflow/errors/unauthorized_error.py +10 -0
  21. webflow-0.1.0b1/src/webflow/oauth.py +114 -0
  22. webflow-0.1.0b1/src/webflow/py.typed +0 -0
  23. webflow-0.1.0b1/src/webflow/resources/__init__.py +46 -0
  24. webflow-0.1.0b1/src/webflow/resources/access_groups/__init__.py +5 -0
  25. webflow-0.1.0b1/src/webflow/resources/access_groups/client.py +148 -0
  26. webflow-0.1.0b1/src/webflow/resources/access_groups/types/__init__.py +5 -0
  27. webflow-0.1.0b1/src/webflow/resources/access_groups/types/access_groups_list_request_sort.py +26 -0
  28. webflow-0.1.0b1/src/webflow/resources/assets/__init__.py +2 -0
  29. webflow-0.1.0b1/src/webflow/resources/assets/client.py +650 -0
  30. webflow-0.1.0b1/src/webflow/resources/collections/__init__.py +5 -0
  31. webflow-0.1.0b1/src/webflow/resources/collections/client.py +456 -0
  32. webflow-0.1.0b1/src/webflow/resources/collections/resources/__init__.py +6 -0
  33. webflow-0.1.0b1/src/webflow/resources/collections/resources/fields/__init__.py +2 -0
  34. webflow-0.1.0b1/src/webflow/resources/collections/resources/fields/client.py +215 -0
  35. webflow-0.1.0b1/src/webflow/resources/collections/resources/items/__init__.py +5 -0
  36. webflow-0.1.0b1/src/webflow/resources/collections/resources/items/client.py +612 -0
  37. webflow-0.1.0b1/src/webflow/resources/collections/resources/items/types/__init__.py +5 -0
  38. webflow-0.1.0b1/src/webflow/resources/collections/resources/items/types/items_publish_item_response.py +30 -0
  39. webflow-0.1.0b1/src/webflow/resources/ecommerce/__init__.py +2 -0
  40. webflow-0.1.0b1/src/webflow/resources/ecommerce/client.py +123 -0
  41. webflow-0.1.0b1/src/webflow/resources/forms/__init__.py +2 -0
  42. webflow-0.1.0b1/src/webflow/resources/forms/client.py +482 -0
  43. webflow-0.1.0b1/src/webflow/resources/inventory/__init__.py +5 -0
  44. webflow-0.1.0b1/src/webflow/resources/inventory/client.py +288 -0
  45. webflow-0.1.0b1/src/webflow/resources/inventory/types/__init__.py +5 -0
  46. webflow-0.1.0b1/src/webflow/resources/inventory/types/inventory_update_request_inventory_type.py +21 -0
  47. webflow-0.1.0b1/src/webflow/resources/orders/__init__.py +5 -0
  48. webflow-0.1.0b1/src/webflow/resources/orders/client.py +765 -0
  49. webflow-0.1.0b1/src/webflow/resources/orders/types/__init__.py +6 -0
  50. webflow-0.1.0b1/src/webflow/resources/orders/types/orders_list_request_status.py +37 -0
  51. webflow-0.1.0b1/src/webflow/resources/orders/types/orders_refund_request_reason.py +29 -0
  52. webflow-0.1.0b1/src/webflow/resources/pages/__init__.py +5 -0
  53. webflow-0.1.0b1/src/webflow/resources/pages/client.py +193 -0
  54. webflow-0.1.0b1/src/webflow/resources/pages/resources/__init__.py +5 -0
  55. webflow-0.1.0b1/src/webflow/resources/pages/resources/scripts/__init__.py +2 -0
  56. webflow-0.1.0b1/src/webflow/resources/pages/resources/scripts/client.py +283 -0
  57. webflow-0.1.0b1/src/webflow/resources/products/__init__.py +5 -0
  58. webflow-0.1.0b1/src/webflow/resources/products/client.py +1085 -0
  59. webflow-0.1.0b1/src/webflow/resources/products/types/__init__.py +5 -0
  60. webflow-0.1.0b1/src/webflow/resources/products/types/products_create_sku_response.py +29 -0
  61. webflow-0.1.0b1/src/webflow/resources/scripts/__init__.py +2 -0
  62. webflow-0.1.0b1/src/webflow/resources/scripts/client.py +360 -0
  63. webflow-0.1.0b1/src/webflow/resources/sites/__init__.py +5 -0
  64. webflow-0.1.0b1/src/webflow/resources/sites/client.py +385 -0
  65. webflow-0.1.0b1/src/webflow/resources/sites/resources/__init__.py +5 -0
  66. webflow-0.1.0b1/src/webflow/resources/sites/resources/scripts/__init__.py +2 -0
  67. webflow-0.1.0b1/src/webflow/resources/sites/resources/scripts/client.py +379 -0
  68. webflow-0.1.0b1/src/webflow/resources/token/__init__.py +2 -0
  69. webflow-0.1.0b1/src/webflow/resources/token/client.py +143 -0
  70. webflow-0.1.0b1/src/webflow/resources/users/__init__.py +5 -0
  71. webflow-0.1.0b1/src/webflow/resources/users/client.py +606 -0
  72. webflow-0.1.0b1/src/webflow/resources/users/types/__init__.py +5 -0
  73. webflow-0.1.0b1/src/webflow/resources/users/types/users_list_request_sort.py +92 -0
  74. webflow-0.1.0b1/src/webflow/resources/webhooks/__init__.py +2 -0
  75. webflow-0.1.0b1/src/webflow/resources/webhooks/client.py +396 -0
  76. webflow-0.1.0b1/src/webflow/types/__init__.py +251 -0
  77. webflow-0.1.0b1/src/webflow/types/access_group.py +40 -0
  78. webflow-0.1.0b1/src/webflow/types/access_group_list.py +40 -0
  79. webflow-0.1.0b1/src/webflow/types/application.py +34 -0
  80. webflow-0.1.0b1/src/webflow/types/asset.py +47 -0
  81. webflow-0.1.0b1/src/webflow/types/asset_folder.py +45 -0
  82. webflow-0.1.0b1/src/webflow/types/asset_folder_list.py +35 -0
  83. webflow-0.1.0b1/src/webflow/types/asset_upload.py +50 -0
  84. webflow-0.1.0b1/src/webflow/types/asset_upload_upload_details.py +47 -0
  85. webflow-0.1.0b1/src/webflow/types/asset_variant.py +36 -0
  86. webflow-0.1.0b1/src/webflow/types/assets.py +29 -0
  87. webflow-0.1.0b1/src/webflow/types/authorization.py +31 -0
  88. webflow-0.1.0b1/src/webflow/types/authorization_authorization.py +50 -0
  89. webflow-0.1.0b1/src/webflow/types/authorization_authorization_authorized_to.py +37 -0
  90. webflow-0.1.0b1/src/webflow/types/authorized_user.py +32 -0
  91. webflow-0.1.0b1/src/webflow/types/collection.py +46 -0
  92. webflow-0.1.0b1/src/webflow/types/collection_item.py +48 -0
  93. webflow-0.1.0b1/src/webflow/types/collection_item_field_data.py +31 -0
  94. webflow-0.1.0b1/src/webflow/types/collection_item_list.py +37 -0
  95. webflow-0.1.0b1/src/webflow/types/collection_item_list_pagination.py +30 -0
  96. webflow-0.1.0b1/src/webflow/types/collection_item_removed.py +32 -0
  97. webflow-0.1.0b1/src/webflow/types/collection_list.py +31 -0
  98. webflow-0.1.0b1/src/webflow/types/collection_list_array_item.py +45 -0
  99. webflow-0.1.0b1/src/webflow/types/custom_code_block.py +48 -0
  100. webflow-0.1.0b1/src/webflow/types/custom_code_block_type.py +21 -0
  101. webflow-0.1.0b1/src/webflow/types/custom_code_response.py +57 -0
  102. webflow-0.1.0b1/src/webflow/types/domain.py +29 -0
  103. webflow-0.1.0b1/src/webflow/types/duplicate_user_email.py +37 -0
  104. webflow-0.1.0b1/src/webflow/types/ecommerce_settings.py +39 -0
  105. webflow-0.1.0b1/src/webflow/types/error.py +35 -0
  106. webflow-0.1.0b1/src/webflow/types/error_details_item.py +5 -0
  107. webflow-0.1.0b1/src/webflow/types/field.py +48 -0
  108. webflow-0.1.0b1/src/webflow/types/field_type.py +69 -0
  109. webflow-0.1.0b1/src/webflow/types/fields.py +7 -0
  110. webflow-0.1.0b1/src/webflow/types/form.py +57 -0
  111. webflow-0.1.0b1/src/webflow/types/form_field.py +7 -0
  112. webflow-0.1.0b1/src/webflow/types/form_field_value.py +37 -0
  113. webflow-0.1.0b1/src/webflow/types/form_field_value_type.py +37 -0
  114. webflow-0.1.0b1/src/webflow/types/form_list.py +31 -0
  115. webflow-0.1.0b1/src/webflow/types/form_response_settings.py +40 -0
  116. webflow-0.1.0b1/src/webflow/types/form_submission.py +44 -0
  117. webflow-0.1.0b1/src/webflow/types/form_submission_list.py +31 -0
  118. webflow-0.1.0b1/src/webflow/types/form_submission_trigger.py +35 -0
  119. webflow-0.1.0b1/src/webflow/types/form_submission_trigger_payload.py +41 -0
  120. webflow-0.1.0b1/src/webflow/types/invalid_domain.py +5 -0
  121. webflow-0.1.0b1/src/webflow/types/inventory_item.py +40 -0
  122. webflow-0.1.0b1/src/webflow/types/inventory_item_inventory_type.py +21 -0
  123. webflow-0.1.0b1/src/webflow/types/list_custom_code_blocks.py +35 -0
  124. webflow-0.1.0b1/src/webflow/types/missing_scopes.py +38 -0
  125. webflow-0.1.0b1/src/webflow/types/no_domains.py +5 -0
  126. webflow-0.1.0b1/src/webflow/types/oauth_scope.py +100 -0
  127. webflow-0.1.0b1/src/webflow/types/order.py +136 -0
  128. webflow-0.1.0b1/src/webflow/types/order_address.py +47 -0
  129. webflow-0.1.0b1/src/webflow/types/order_address_japan_type.py +21 -0
  130. webflow-0.1.0b1/src/webflow/types/order_address_type.py +21 -0
  131. webflow-0.1.0b1/src/webflow/types/order_customer_info.py +34 -0
  132. webflow-0.1.0b1/src/webflow/types/order_dispute_last_status.py +49 -0
  133. webflow-0.1.0b1/src/webflow/types/order_download_files_item.py +30 -0
  134. webflow-0.1.0b1/src/webflow/types/order_list.py +35 -0
  135. webflow-0.1.0b1/src/webflow/types/order_metadata.py +29 -0
  136. webflow-0.1.0b1/src/webflow/types/order_price.py +30 -0
  137. webflow-0.1.0b1/src/webflow/types/order_purchased_item.py +66 -0
  138. webflow-0.1.0b1/src/webflow/types/order_purchased_item_variant_image.py +30 -0
  139. webflow-0.1.0b1/src/webflow/types/order_purchased_item_variant_image_file.py +42 -0
  140. webflow-0.1.0b1/src/webflow/types/order_purchased_item_variant_image_file_variants_item.py +33 -0
  141. webflow-0.1.0b1/src/webflow/types/order_status.py +41 -0
  142. webflow-0.1.0b1/src/webflow/types/order_totals.py +38 -0
  143. webflow-0.1.0b1/src/webflow/types/order_totals_extras_item.py +41 -0
  144. webflow-0.1.0b1/src/webflow/types/order_totals_extras_item_type.py +33 -0
  145. webflow-0.1.0b1/src/webflow/types/page.py +63 -0
  146. webflow-0.1.0b1/src/webflow/types/page_created_webhook.py +36 -0
  147. webflow-0.1.0b1/src/webflow/types/page_deleted_webhook.py +36 -0
  148. webflow-0.1.0b1/src/webflow/types/page_list.py +35 -0
  149. webflow-0.1.0b1/src/webflow/types/page_metadata_updated_webhook.py +36 -0
  150. webflow-0.1.0b1/src/webflow/types/page_open_graph.py +41 -0
  151. webflow-0.1.0b1/src/webflow/types/page_seo.py +35 -0
  152. webflow-0.1.0b1/src/webflow/types/page_seo_graph_data.py +36 -0
  153. webflow-0.1.0b1/src/webflow/types/page_seo_graph_data_open_graph.py +29 -0
  154. webflow-0.1.0b1/src/webflow/types/page_seo_graph_data_seo.py +29 -0
  155. webflow-0.1.0b1/src/webflow/types/pagination.py +34 -0
  156. webflow-0.1.0b1/src/webflow/types/paypal_details.py +36 -0
  157. webflow-0.1.0b1/src/webflow/types/product.py +50 -0
  158. webflow-0.1.0b1/src/webflow/types/product_and_sk_us.py +35 -0
  159. webflow-0.1.0b1/src/webflow/types/product_and_sk_us_list.py +37 -0
  160. webflow-0.1.0b1/src/webflow/types/product_field_data.py +34 -0
  161. webflow-0.1.0b1/src/webflow/types/publish_status.py +21 -0
  162. webflow-0.1.0b1/src/webflow/types/published_items.py +36 -0
  163. webflow-0.1.0b1/src/webflow/types/published_site.py +28 -0
  164. webflow-0.1.0b1/src/webflow/types/registered_script_list.py +30 -0
  165. webflow-0.1.0b1/src/webflow/types/removed_items.py +36 -0
  166. webflow-0.1.0b1/src/webflow/types/script_apply.py +36 -0
  167. webflow-0.1.0b1/src/webflow/types/script_apply_list.py +36 -0
  168. webflow-0.1.0b1/src/webflow/types/script_apply_location.py +21 -0
  169. webflow-0.1.0b1/src/webflow/types/site.py +51 -0
  170. webflow-0.1.0b1/src/webflow/types/site_activity_log_item.py +42 -0
  171. webflow-0.1.0b1/src/webflow/types/site_activity_log_item_resource_operation.py +33 -0
  172. webflow-0.1.0b1/src/webflow/types/site_activity_log_response.py +31 -0
  173. webflow-0.1.0b1/src/webflow/types/site_publish.py +29 -0
  174. webflow-0.1.0b1/src/webflow/types/site_publish_payload.py +40 -0
  175. webflow-0.1.0b1/src/webflow/types/sites.py +29 -0
  176. webflow-0.1.0b1/src/webflow/types/sku.py +44 -0
  177. webflow-0.1.0b1/src/webflow/types/sku_field_data.py +34 -0
  178. webflow-0.1.0b1/src/webflow/types/sku_field_data_price.py +33 -0
  179. webflow-0.1.0b1/src/webflow/types/sku_property_list.py +39 -0
  180. webflow-0.1.0b1/src/webflow/types/sku_property_list_enum_item.py +36 -0
  181. webflow-0.1.0b1/src/webflow/types/sku_value_list.py +5 -0
  182. webflow-0.1.0b1/src/webflow/types/stripe_card.py +40 -0
  183. webflow-0.1.0b1/src/webflow/types/stripe_card_brand.py +45 -0
  184. webflow-0.1.0b1/src/webflow/types/stripe_card_expires.py +33 -0
  185. webflow-0.1.0b1/src/webflow/types/stripe_details.py +56 -0
  186. webflow-0.1.0b1/src/webflow/types/trigger_type.py +91 -0
  187. webflow-0.1.0b1/src/webflow/types/user.py +56 -0
  188. webflow-0.1.0b1/src/webflow/types/user_access_groups_item.py +41 -0
  189. webflow-0.1.0b1/src/webflow/types/user_access_groups_item_type.py +24 -0
  190. webflow-0.1.0b1/src/webflow/types/user_data.py +33 -0
  191. webflow-0.1.0b1/src/webflow/types/user_data_data.py +40 -0
  192. webflow-0.1.0b1/src/webflow/types/user_limit_reached.py +37 -0
  193. webflow-0.1.0b1/src/webflow/types/user_list.py +37 -0
  194. webflow-0.1.0b1/src/webflow/types/user_status.py +29 -0
  195. webflow-0.1.0b1/src/webflow/types/user_webhook_payload.py +34 -0
  196. webflow-0.1.0b1/src/webflow/types/user_webhook_payload_trigger_type.py +29 -0
  197. webflow-0.1.0b1/src/webflow/types/users_not_enabled.py +37 -0
  198. webflow-0.1.0b1/src/webflow/types/webhook.py +47 -0
  199. webflow-0.1.0b1/src/webflow/types/webhook_list.py +31 -0
@@ -0,0 +1,193 @@
1
+ Metadata-Version: 2.1
2
+ Name: webflow
3
+ Version: 0.1.0b1
4
+ Summary:
5
+ Requires-Python: >=3.7,<4.0
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Programming Language :: Python :: 3.7
8
+ Classifier: Programming Language :: Python :: 3.8
9
+ Classifier: Programming Language :: Python :: 3.9
10
+ Classifier: Programming Language :: Python :: 3.10
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Requires-Dist: httpx (>=0.21.2)
13
+ Requires-Dist: pydantic (>=1.9.2,<2.5.0)
14
+ Description-Content-Type: text/markdown
15
+
16
+ # Webflow Python Library
17
+
18
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern)
19
+
20
+ The Webflow Python Library provides convenient access to the Webflow API from
21
+ applications written in Python. The library includes type definitions for all
22
+ request and response fields, and offers both synchronous and asynchronous clients powered by httpx.
23
+
24
+ ## Documentation
25
+
26
+ API reference documentation is available [here](https://developers.webflow.com/reference/designer-api-reference).
27
+
28
+ ## Installation
29
+
30
+ Add this dependency to your project's build file:
31
+
32
+ ```bash
33
+ pip install webflow
34
+ # or
35
+ poetry add webflow
36
+ ```
37
+
38
+ ## Usage
39
+ Simply import `Webflow` and start making calls to our API.
40
+
41
+ ```python
42
+ from webflow.client import Webflow
43
+
44
+ client = Webflow(
45
+ client_id="YOUR_CLIENT_ID",
46
+ client_secret="YOUR_CLIENT_SECRET",
47
+ code="YOUR_AUTHORIZATION_CODE"
48
+ )
49
+ site = client.sites.get("site-id")
50
+ ```
51
+
52
+ ## Async Client
53
+ The SDK also exports an async client so that you can make non-blocking
54
+ calls to our API.
55
+
56
+ ```python
57
+ from webflow.client import AsyncWebflow
58
+
59
+ client = AsyncWebflow(
60
+ client_id="YOUR_CLIENT_ID",
61
+ client_secret="YOUR_CLIENT_SECRET",
62
+ code="YOUR_AUTHORIZATION_CODE"
63
+ )
64
+
65
+ async def main() -> None:
66
+ site = await client.sites.get("site-id")
67
+ print("Received site", site)
68
+
69
+ asyncio.run(main())
70
+ ```
71
+
72
+ ## OAuth
73
+
74
+ To implement OAuth, you'll need a registred Webflow App.
75
+
76
+ ### Step 1: Authorize URL
77
+
78
+ The first step in OAuth is to generate an authorization url. Use this URL
79
+ to fetch your authorization code. See the [docs](https://docs.developers.webflow.com/v1.0.0/docs/oauth#user-authorization)
80
+ for more details.
81
+
82
+ ```python
83
+ from webflow.oauth import authorize_url
84
+ from webflow import OauthScope
85
+
86
+ url = webflow.authorize_url({
87
+ client_id = "[CLIENT ID]",
88
+ scope = OauthScope.ReadUsers, # or [OauthScope.ReadUsers, OauthScope.WriteUsers]
89
+ state = "1234567890", # optional
90
+ redirect_uri = "https://my.server.com/oauth/callback", # optional
91
+ });
92
+
93
+ print(url)
94
+ ```
95
+
96
+ ### Step 2: Instantiate the client
97
+ Pass in your `client_id`, `client_secret`, `authorization_code` when instantiating
98
+ the client. Our SDK handles generating an access token and passing that to every endpoint.
99
+
100
+ ```python
101
+ from webflow.client import Webflow
102
+
103
+ client = Webflow(
104
+ client_id="YOUR_CLIENT_ID",
105
+ client_secret="YOUR_CLIENT_SECRET",
106
+ code="YOUR_AUTHORIZATION_CODE",
107
+ redirect_uri = "https://my.server.com/oauth/callback", # optional
108
+ )
109
+ ```
110
+
111
+ If you want to generate an access token yourself, simply import the
112
+ `get_access_token` function.
113
+
114
+ ```python
115
+ from webflow.oauth import get_access_token
116
+
117
+ access_token = get_access_token(
118
+ client_id="YOUR_CLIENT_ID",
119
+ client_secret="YOUR_CLIENT_SECRET",
120
+ code="YOUR_AUTHORIZATION_CODE"
121
+ )
122
+ ```
123
+
124
+ ## Webflow Module
125
+ All of the models are nested within the Webflow module. Let Intellisense
126
+ guide you!
127
+
128
+ ![Alt text](assets/module.png)
129
+
130
+ ## Exception Handling
131
+ All errors thrown by the SDK will be sublcasses of [`ApiError`](./src/webflow/core/api_error.py).
132
+
133
+ ```python
134
+ import webflow
135
+
136
+ try:
137
+ client.sites.get(...)
138
+ except webflow.core.ApiError as e: # Handle all errors
139
+ print(e.status_code)
140
+ print(e.body)
141
+ except webflow.BadRequestError as e: # Handle specific error
142
+ print(e.status_code)
143
+ print(e.body)
144
+ ```
145
+
146
+ ## Advanced
147
+
148
+ ### Timeouts
149
+ By default requests time out after 60 seconds. You can configure this with a
150
+ timeout option, which accepts a float.
151
+
152
+ ```python
153
+ from webflow.client import Webflow
154
+
155
+ client = Webflow(
156
+ # 20 seconds
157
+ timeout=20.0,
158
+ )
159
+ ```
160
+
161
+ ### Custom HTTP client
162
+ You can override the httpx client to customize it for your use case. Some common usecases
163
+ include support for proxies and transports.
164
+
165
+ ```python
166
+ import httpx
167
+
168
+ from webflow.client import Webflow
169
+
170
+ client = Webflow(
171
+ http_client=httpx.Client(
172
+ proxies="http://my.test.proxy.example.com",
173
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
174
+ ),
175
+ )
176
+ ```
177
+
178
+ ## Beta Status
179
+
180
+ This SDK is in beta, and there may be breaking changes between versions without a major
181
+ version update. Therefore, we recommend pinning the package version to a specific version.
182
+ This way, you can install the same version each time without breaking changes.
183
+
184
+ ## Contributing
185
+
186
+ While we value open-source contributions to this SDK, this library is generated programmatically.
187
+ Additions made directly to this library would have to be moved over to our generation code,
188
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
189
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
190
+ an issue first to discuss with us!
191
+
192
+ On the other hand, contributions to the README are always very welcome!
193
+
@@ -0,0 +1,177 @@
1
+ # Webflow Python Library
2
+
3
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-SDK%20generated%20by%20Fern-brightgreen)](https://github.com/fern-api/fern)
4
+
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.
8
+
9
+ ## Documentation
10
+
11
+ API reference documentation is available [here](https://developers.webflow.com/reference/designer-api-reference).
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
21
+ ```
22
+
23
+ ## Usage
24
+ Simply import `Webflow` and start making calls to our API.
25
+
26
+ ```python
27
+ from webflow.client import Webflow
28
+
29
+ client = Webflow(
30
+ client_id="YOUR_CLIENT_ID",
31
+ client_secret="YOUR_CLIENT_SECRET",
32
+ code="YOUR_AUTHORIZATION_CODE"
33
+ )
34
+ site = client.sites.get("site-id")
35
+ ```
36
+
37
+ ## Async Client
38
+ The SDK also exports an async client so that you can make non-blocking
39
+ calls to our API.
40
+
41
+ ```python
42
+ from webflow.client import AsyncWebflow
43
+
44
+ client = AsyncWebflow(
45
+ client_id="YOUR_CLIENT_ID",
46
+ client_secret="YOUR_CLIENT_SECRET",
47
+ code="YOUR_AUTHORIZATION_CODE"
48
+ )
49
+
50
+ async def main() -> None:
51
+ site = await client.sites.get("site-id")
52
+ print("Received site", site)
53
+
54
+ asyncio.run(main())
55
+ ```
56
+
57
+ ## OAuth
58
+
59
+ To implement OAuth, you'll need a registred Webflow App.
60
+
61
+ ### Step 1: Authorize URL
62
+
63
+ The first step in OAuth is to generate an authorization url. Use this URL
64
+ to fetch your authorization code. See the [docs](https://docs.developers.webflow.com/v1.0.0/docs/oauth#user-authorization)
65
+ for more details.
66
+
67
+ ```python
68
+ from webflow.oauth import authorize_url
69
+ from webflow import OauthScope
70
+
71
+ url = webflow.authorize_url({
72
+ client_id = "[CLIENT ID]",
73
+ scope = OauthScope.ReadUsers, # or [OauthScope.ReadUsers, OauthScope.WriteUsers]
74
+ state = "1234567890", # optional
75
+ redirect_uri = "https://my.server.com/oauth/callback", # optional
76
+ });
77
+
78
+ print(url)
79
+ ```
80
+
81
+ ### Step 2: Instantiate the client
82
+ Pass in your `client_id`, `client_secret`, `authorization_code` when instantiating
83
+ the client. Our SDK handles generating an access token and passing that to every endpoint.
84
+
85
+ ```python
86
+ from webflow.client import Webflow
87
+
88
+ client = Webflow(
89
+ client_id="YOUR_CLIENT_ID",
90
+ client_secret="YOUR_CLIENT_SECRET",
91
+ code="YOUR_AUTHORIZATION_CODE",
92
+ redirect_uri = "https://my.server.com/oauth/callback", # optional
93
+ )
94
+ ```
95
+
96
+ If you want to generate an access token yourself, simply import the
97
+ `get_access_token` function.
98
+
99
+ ```python
100
+ from webflow.oauth import get_access_token
101
+
102
+ access_token = get_access_token(
103
+ client_id="YOUR_CLIENT_ID",
104
+ client_secret="YOUR_CLIENT_SECRET",
105
+ code="YOUR_AUTHORIZATION_CODE"
106
+ )
107
+ ```
108
+
109
+ ## Webflow Module
110
+ All of the models are nested within the Webflow module. Let Intellisense
111
+ guide you!
112
+
113
+ ![Alt text](assets/module.png)
114
+
115
+ ## Exception Handling
116
+ All errors thrown by the SDK will be sublcasses of [`ApiError`](./src/webflow/core/api_error.py).
117
+
118
+ ```python
119
+ import webflow
120
+
121
+ try:
122
+ client.sites.get(...)
123
+ except webflow.core.ApiError as e: # Handle all errors
124
+ print(e.status_code)
125
+ print(e.body)
126
+ except webflow.BadRequestError as e: # Handle specific error
127
+ print(e.status_code)
128
+ print(e.body)
129
+ ```
130
+
131
+ ## Advanced
132
+
133
+ ### Timeouts
134
+ By default requests time out after 60 seconds. You can configure this with a
135
+ timeout option, which accepts a float.
136
+
137
+ ```python
138
+ from webflow.client import Webflow
139
+
140
+ client = Webflow(
141
+ # 20 seconds
142
+ timeout=20.0,
143
+ )
144
+ ```
145
+
146
+ ### Custom HTTP client
147
+ You can override the httpx client to customize it for your use case. Some common usecases
148
+ include support for proxies and transports.
149
+
150
+ ```python
151
+ import httpx
152
+
153
+ from webflow.client import Webflow
154
+
155
+ client = Webflow(
156
+ http_client=httpx.Client(
157
+ proxies="http://my.test.proxy.example.com",
158
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
159
+ ),
160
+ )
161
+ ```
162
+
163
+ ## Beta Status
164
+
165
+ This SDK is in beta, and there may be breaking changes between versions without a major
166
+ version update. Therefore, we recommend pinning the package version to a specific version.
167
+ This way, you can install the same version each time without breaking changes.
168
+
169
+ ## Contributing
170
+
171
+ While we value open-source contributions to this SDK, this library is generated programmatically.
172
+ Additions made directly to this library would have to be moved over to our generation code,
173
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
174
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
175
+ an issue first to discuss with us!
176
+
177
+ On the other hand, contributions to the README are always very welcome!
@@ -0,0 +1,22 @@
1
+ [tool.poetry]
2
+ name = "webflow"
3
+ version = "0.1.0b1"
4
+ description = ""
5
+ readme = "README.md"
6
+ authors = []
7
+ packages = [
8
+ { include = "webflow", from = "src"}
9
+ ]
10
+
11
+ [tool.poetry.dependencies]
12
+ python = "^3.7"
13
+ httpx = ">=0.21.2"
14
+ pydantic = ">= 1.9.2, < 2.5.0"
15
+
16
+ [tool.poetry.dev-dependencies]
17
+ mypy = "0.971"
18
+ pytest = "^7.4.0"
19
+
20
+ [build-system]
21
+ requires = ["poetry-core"]
22
+ build-backend = "poetry.core.masonry.api"
@@ -0,0 +1,313 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ from .types import (
4
+ AccessGroup,
5
+ AccessGroupList,
6
+ Application,
7
+ Asset,
8
+ AssetFolder,
9
+ AssetFolderList,
10
+ AssetUpload,
11
+ AssetUploadUploadDetails,
12
+ AssetVariant,
13
+ Assets,
14
+ Authorization,
15
+ AuthorizationAuthorization,
16
+ AuthorizationAuthorizationAuthorizedTo,
17
+ AuthorizedUser,
18
+ Collection,
19
+ CollectionItem,
20
+ CollectionItemFieldData,
21
+ CollectionItemList,
22
+ CollectionItemListPagination,
23
+ CollectionItemRemoved,
24
+ CollectionList,
25
+ CollectionListArrayItem,
26
+ CustomCodeBlock,
27
+ CustomCodeBlockType,
28
+ CustomCodeResponse,
29
+ Domain,
30
+ DuplicateUserEmail,
31
+ EcommerceSettings,
32
+ Error,
33
+ ErrorDetailsItem,
34
+ Field,
35
+ FieldType,
36
+ Fields,
37
+ Form,
38
+ FormField,
39
+ FormFieldValue,
40
+ FormFieldValueType,
41
+ FormList,
42
+ FormResponseSettings,
43
+ FormSubmission,
44
+ FormSubmissionList,
45
+ FormSubmissionTrigger,
46
+ FormSubmissionTriggerPayload,
47
+ InvalidDomain,
48
+ InventoryItem,
49
+ InventoryItemInventoryType,
50
+ ListCustomCodeBlocks,
51
+ MissingScopes,
52
+ NoDomains,
53
+ OauthScope,
54
+ Order,
55
+ OrderAddress,
56
+ OrderAddressJapanType,
57
+ OrderAddressType,
58
+ OrderCustomerInfo,
59
+ OrderDisputeLastStatus,
60
+ OrderDownloadFilesItem,
61
+ OrderList,
62
+ OrderMetadata,
63
+ OrderPrice,
64
+ OrderPurchasedItem,
65
+ OrderPurchasedItemVariantImage,
66
+ OrderPurchasedItemVariantImageFile,
67
+ OrderPurchasedItemVariantImageFileVariantsItem,
68
+ OrderStatus,
69
+ OrderTotals,
70
+ OrderTotalsExtrasItem,
71
+ OrderTotalsExtrasItemType,
72
+ Page,
73
+ PageCreatedWebhook,
74
+ PageDeletedWebhook,
75
+ PageList,
76
+ PageMetadataUpdatedWebhook,
77
+ PageOpenGraph,
78
+ PageSeo,
79
+ PageSeoGraphData,
80
+ PageSeoGraphDataOpenGraph,
81
+ PageSeoGraphDataSeo,
82
+ Pagination,
83
+ PaypalDetails,
84
+ Product,
85
+ ProductAndSkUs,
86
+ ProductAndSkUsList,
87
+ ProductFieldData,
88
+ PublishStatus,
89
+ PublishedItems,
90
+ PublishedSite,
91
+ RegisteredScriptList,
92
+ RemovedItems,
93
+ ScriptApply,
94
+ ScriptApplyList,
95
+ ScriptApplyLocation,
96
+ Site,
97
+ SiteActivityLogItem,
98
+ SiteActivityLogItemResourceOperation,
99
+ SiteActivityLogResponse,
100
+ SitePublish,
101
+ SitePublishPayload,
102
+ Sites,
103
+ Sku,
104
+ SkuFieldData,
105
+ SkuFieldDataPrice,
106
+ SkuPropertyList,
107
+ SkuPropertyListEnumItem,
108
+ SkuValueList,
109
+ StripeCard,
110
+ StripeCardBrand,
111
+ StripeCardExpires,
112
+ StripeDetails,
113
+ TriggerType,
114
+ User,
115
+ UserAccessGroupsItem,
116
+ UserAccessGroupsItemType,
117
+ UserData,
118
+ UserDataData,
119
+ UserLimitReached,
120
+ UserList,
121
+ UserStatus,
122
+ UserWebhookPayload,
123
+ UserWebhookPayloadTriggerType,
124
+ UsersNotEnabled,
125
+ Webhook,
126
+ WebhookList,
127
+ )
128
+ from .errors import (
129
+ BadRequestError,
130
+ ConflictError,
131
+ ForbiddenError,
132
+ InternalServerError,
133
+ NotFoundError,
134
+ TooManyRequestsError,
135
+ UnauthorizedError,
136
+ )
137
+ from .resources import (
138
+ AccessGroupsListRequestSort,
139
+ InventoryUpdateRequestInventoryType,
140
+ OrdersListRequestStatus,
141
+ OrdersRefundRequestReason,
142
+ ProductsCreateSkuResponse,
143
+ UsersListRequestSort,
144
+ access_groups,
145
+ assets,
146
+ collections,
147
+ ecommerce,
148
+ forms,
149
+ inventory,
150
+ orders,
151
+ pages,
152
+ products,
153
+ scripts,
154
+ sites,
155
+ token,
156
+ users,
157
+ webhooks,
158
+ )
159
+ from .environment import WebflowEnvironment
160
+
161
+ __all__ = [
162
+ "AccessGroup",
163
+ "AccessGroupList",
164
+ "AccessGroupsListRequestSort",
165
+ "Application",
166
+ "Asset",
167
+ "AssetFolder",
168
+ "AssetFolderList",
169
+ "AssetUpload",
170
+ "AssetUploadUploadDetails",
171
+ "AssetVariant",
172
+ "Assets",
173
+ "Authorization",
174
+ "AuthorizationAuthorization",
175
+ "AuthorizationAuthorizationAuthorizedTo",
176
+ "AuthorizedUser",
177
+ "BadRequestError",
178
+ "Collection",
179
+ "CollectionItem",
180
+ "CollectionItemFieldData",
181
+ "CollectionItemList",
182
+ "CollectionItemListPagination",
183
+ "CollectionItemRemoved",
184
+ "CollectionList",
185
+ "CollectionListArrayItem",
186
+ "ConflictError",
187
+ "CustomCodeBlock",
188
+ "CustomCodeBlockType",
189
+ "CustomCodeResponse",
190
+ "Domain",
191
+ "DuplicateUserEmail",
192
+ "EcommerceSettings",
193
+ "Error",
194
+ "ErrorDetailsItem",
195
+ "Field",
196
+ "FieldType",
197
+ "Fields",
198
+ "ForbiddenError",
199
+ "Form",
200
+ "FormField",
201
+ "FormFieldValue",
202
+ "FormFieldValueType",
203
+ "FormList",
204
+ "FormResponseSettings",
205
+ "FormSubmission",
206
+ "FormSubmissionList",
207
+ "FormSubmissionTrigger",
208
+ "FormSubmissionTriggerPayload",
209
+ "InternalServerError",
210
+ "InvalidDomain",
211
+ "InventoryItem",
212
+ "InventoryItemInventoryType",
213
+ "InventoryUpdateRequestInventoryType",
214
+ "ListCustomCodeBlocks",
215
+ "MissingScopes",
216
+ "NoDomains",
217
+ "NotFoundError",
218
+ "OauthScope",
219
+ "Order",
220
+ "OrderAddress",
221
+ "OrderAddressJapanType",
222
+ "OrderAddressType",
223
+ "OrderCustomerInfo",
224
+ "OrderDisputeLastStatus",
225
+ "OrderDownloadFilesItem",
226
+ "OrderList",
227
+ "OrderMetadata",
228
+ "OrderPrice",
229
+ "OrderPurchasedItem",
230
+ "OrderPurchasedItemVariantImage",
231
+ "OrderPurchasedItemVariantImageFile",
232
+ "OrderPurchasedItemVariantImageFileVariantsItem",
233
+ "OrderStatus",
234
+ "OrderTotals",
235
+ "OrderTotalsExtrasItem",
236
+ "OrderTotalsExtrasItemType",
237
+ "OrdersListRequestStatus",
238
+ "OrdersRefundRequestReason",
239
+ "Page",
240
+ "PageCreatedWebhook",
241
+ "PageDeletedWebhook",
242
+ "PageList",
243
+ "PageMetadataUpdatedWebhook",
244
+ "PageOpenGraph",
245
+ "PageSeo",
246
+ "PageSeoGraphData",
247
+ "PageSeoGraphDataOpenGraph",
248
+ "PageSeoGraphDataSeo",
249
+ "Pagination",
250
+ "PaypalDetails",
251
+ "Product",
252
+ "ProductAndSkUs",
253
+ "ProductAndSkUsList",
254
+ "ProductFieldData",
255
+ "ProductsCreateSkuResponse",
256
+ "PublishStatus",
257
+ "PublishedItems",
258
+ "PublishedSite",
259
+ "RegisteredScriptList",
260
+ "RemovedItems",
261
+ "ScriptApply",
262
+ "ScriptApplyList",
263
+ "ScriptApplyLocation",
264
+ "Site",
265
+ "SiteActivityLogItem",
266
+ "SiteActivityLogItemResourceOperation",
267
+ "SiteActivityLogResponse",
268
+ "SitePublish",
269
+ "SitePublishPayload",
270
+ "Sites",
271
+ "Sku",
272
+ "SkuFieldData",
273
+ "SkuFieldDataPrice",
274
+ "SkuPropertyList",
275
+ "SkuPropertyListEnumItem",
276
+ "SkuValueList",
277
+ "StripeCard",
278
+ "StripeCardBrand",
279
+ "StripeCardExpires",
280
+ "StripeDetails",
281
+ "TooManyRequestsError",
282
+ "TriggerType",
283
+ "UnauthorizedError",
284
+ "User",
285
+ "UserAccessGroupsItem",
286
+ "UserAccessGroupsItemType",
287
+ "UserData",
288
+ "UserDataData",
289
+ "UserLimitReached",
290
+ "UserList",
291
+ "UserStatus",
292
+ "UserWebhookPayload",
293
+ "UserWebhookPayloadTriggerType",
294
+ "UsersListRequestSort",
295
+ "UsersNotEnabled",
296
+ "WebflowEnvironment",
297
+ "Webhook",
298
+ "WebhookList",
299
+ "access_groups",
300
+ "assets",
301
+ "collections",
302
+ "ecommerce",
303
+ "forms",
304
+ "inventory",
305
+ "orders",
306
+ "pages",
307
+ "products",
308
+ "scripts",
309
+ "sites",
310
+ "token",
311
+ "users",
312
+ "webhooks",
313
+ ]