schedulin 0.1.0__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 (143) hide show
  1. schedulin-0.1.0/LICENSE +21 -0
  2. schedulin-0.1.0/PKG-INFO +205 -0
  3. schedulin-0.1.0/README.md +190 -0
  4. schedulin-0.1.0/pyproject.toml +34 -0
  5. schedulin-0.1.0/schedulin/__init__.py +334 -0
  6. schedulin-0.1.0/schedulin/_default_clients.py +30 -0
  7. schedulin-0.1.0/schedulin/client.py +269 -0
  8. schedulin-0.1.0/schedulin/core/__init__.py +127 -0
  9. schedulin-0.1.0/schedulin/core/api_error.py +23 -0
  10. schedulin-0.1.0/schedulin/core/client_wrapper.py +120 -0
  11. schedulin-0.1.0/schedulin/core/datetime_utils.py +70 -0
  12. schedulin-0.1.0/schedulin/core/file.py +67 -0
  13. schedulin-0.1.0/schedulin/core/force_multipart.py +18 -0
  14. schedulin-0.1.0/schedulin/core/http_client.py +839 -0
  15. schedulin-0.1.0/schedulin/core/http_response.py +59 -0
  16. schedulin-0.1.0/schedulin/core/http_sse/__init__.py +42 -0
  17. schedulin-0.1.0/schedulin/core/http_sse/_api.py +170 -0
  18. schedulin-0.1.0/schedulin/core/http_sse/_decoders.py +61 -0
  19. schedulin-0.1.0/schedulin/core/http_sse/_exceptions.py +7 -0
  20. schedulin-0.1.0/schedulin/core/http_sse/_models.py +17 -0
  21. schedulin-0.1.0/schedulin/core/jsonable_encoder.py +120 -0
  22. schedulin-0.1.0/schedulin/core/logging.py +107 -0
  23. schedulin-0.1.0/schedulin/core/parse_error.py +36 -0
  24. schedulin-0.1.0/schedulin/core/pydantic_utilities.py +508 -0
  25. schedulin-0.1.0/schedulin/core/query_encoder.py +58 -0
  26. schedulin-0.1.0/schedulin/core/remove_none_from_dict.py +11 -0
  27. schedulin-0.1.0/schedulin/core/request_options.py +35 -0
  28. schedulin-0.1.0/schedulin/core/serialization.py +347 -0
  29. schedulin-0.1.0/schedulin/environment.py +7 -0
  30. schedulin-0.1.0/schedulin/errors/__init__.py +38 -0
  31. schedulin-0.1.0/schedulin/errors/internal_server_error.py +11 -0
  32. schedulin-0.1.0/schedulin/errors/unauthorized_error.py +11 -0
  33. schedulin-0.1.0/schedulin/media/__init__.py +55 -0
  34. schedulin-0.1.0/schedulin/media/client.py +613 -0
  35. schedulin-0.1.0/schedulin/media/raw_client.py +997 -0
  36. schedulin-0.1.0/schedulin/media/types/__init__.py +53 -0
  37. schedulin-0.1.0/schedulin/media/types/count_by_tag_media_response.py +20 -0
  38. schedulin-0.1.0/schedulin/media/types/count_by_tag_media_response_data_item.py +22 -0
  39. schedulin-0.1.0/schedulin/media/types/create_presigned_post_intent.py +5 -0
  40. schedulin-0.1.0/schedulin/media/types/list_media_request_cursor.py +25 -0
  41. schedulin-0.1.0/schedulin/media/types/list_media_request_tag_mode.py +5 -0
  42. schedulin-0.1.0/schedulin/media/types/list_media_request_type.py +5 -0
  43. schedulin-0.1.0/schedulin/posts/__init__.py +121 -0
  44. schedulin-0.1.0/schedulin/posts/client.py +1073 -0
  45. schedulin-0.1.0/schedulin/posts/raw_client.py +1775 -0
  46. schedulin-0.1.0/schedulin/posts/types/__init__.py +119 -0
  47. schedulin-0.1.0/schedulin/posts/types/analytics_series_posts_response.py +20 -0
  48. schedulin-0.1.0/schedulin/posts/types/analytics_series_posts_response_data_item.py +28 -0
  49. schedulin-0.1.0/schedulin/posts/types/analytics_summary_posts_response.py +37 -0
  50. schedulin-0.1.0/schedulin/posts/types/create_posts_response.py +48 -0
  51. schedulin-0.1.0/schedulin/posts/types/create_posts_response_media_item.py +25 -0
  52. schedulin-0.1.0/schedulin/posts/types/create_posts_response_media_item_tags_item.py +25 -0
  53. schedulin-0.1.0/schedulin/posts/types/create_posts_response_media_item_tags_item_platform.py +20 -0
  54. schedulin-0.1.0/schedulin/posts/types/create_posts_response_media_item_tags_item_type.py +5 -0
  55. schedulin-0.1.0/schedulin/posts/types/list_posts_request_approval_status.py +7 -0
  56. schedulin-0.1.0/schedulin/posts/types/list_posts_request_status.py +7 -0
  57. schedulin-0.1.0/schedulin/posts/types/list_posts_request_tag_mode.py +5 -0
  58. schedulin-0.1.0/schedulin/posts/types/list_posts_response.py +27 -0
  59. schedulin-0.1.0/schedulin/posts/types/post_create_action.py +5 -0
  60. schedulin-0.1.0/schedulin/posts/types/post_create_media_item.py +35 -0
  61. schedulin-0.1.0/schedulin/posts/types/post_create_media_item_tags_item.py +25 -0
  62. schedulin-0.1.0/schedulin/posts/types/post_create_media_item_tags_item_platform.py +20 -0
  63. schedulin-0.1.0/schedulin/posts/types/post_create_media_item_tags_item_type.py +5 -0
  64. schedulin-0.1.0/schedulin/posts/types/post_create_parts_item.py +21 -0
  65. schedulin-0.1.0/schedulin/posts/types/post_create_parts_item_media_item.py +35 -0
  66. schedulin-0.1.0/schedulin/posts/types/post_create_parts_item_media_item_tags_item.py +25 -0
  67. schedulin-0.1.0/schedulin/posts/types/post_create_parts_item_media_item_tags_item_platform.py +20 -0
  68. schedulin-0.1.0/schedulin/posts/types/post_create_parts_item_media_item_tags_item_type.py +5 -0
  69. schedulin-0.1.0/schedulin/posts/types/post_create_thumbnail.py +35 -0
  70. schedulin-0.1.0/schedulin/posts/types/post_create_thumbnail_tags_item.py +25 -0
  71. schedulin-0.1.0/schedulin/posts/types/post_create_thumbnail_tags_item_platform.py +20 -0
  72. schedulin-0.1.0/schedulin/posts/types/post_create_thumbnail_tags_item_type.py +5 -0
  73. schedulin-0.1.0/schedulin/posts/types/update_posts_request_media_item.py +26 -0
  74. schedulin-0.1.0/schedulin/posts/types/update_posts_request_status.py +7 -0
  75. schedulin-0.1.0/schedulin/social_accounts/__init__.py +79 -0
  76. schedulin-0.1.0/schedulin/social_accounts/client.py +487 -0
  77. schedulin-0.1.0/schedulin/social_accounts/raw_client.py +854 -0
  78. schedulin-0.1.0/schedulin/social_accounts/types/__init__.py +79 -0
  79. schedulin-0.1.0/schedulin/social_accounts/types/delete_social_accounts_response.py +19 -0
  80. schedulin-0.1.0/schedulin/social_accounts/types/list_social_accounts_response.py +20 -0
  81. schedulin-0.1.0/schedulin/social_accounts/types/list_social_accounts_response_data_item.py +47 -0
  82. schedulin-0.1.0/schedulin/social_accounts/types/list_social_accounts_response_data_item_platform.py +20 -0
  83. schedulin-0.1.0/schedulin/social_accounts/types/list_social_accounts_response_data_item_status.py +5 -0
  84. schedulin-0.1.0/schedulin/social_accounts/types/pinterest_boards_social_accounts_response.py +20 -0
  85. schedulin-0.1.0/schedulin/social_accounts/types/pinterest_boards_social_accounts_response_data_item.py +24 -0
  86. schedulin-0.1.0/schedulin/social_accounts/types/pinterest_boards_social_accounts_response_data_item_privacy.py +7 -0
  87. schedulin-0.1.0/schedulin/social_accounts/types/tiktok_creator_info_social_accounts_response.py +22 -0
  88. schedulin-0.1.0/schedulin/social_accounts/types/tiktok_creator_info_social_accounts_response_data.py +26 -0
  89. schedulin-0.1.0/schedulin/social_accounts/types/tiktok_creator_info_social_accounts_response_error.py +21 -0
  90. schedulin-0.1.0/schedulin/social_accounts/types/update_social_accounts_request_status.py +5 -0
  91. schedulin-0.1.0/schedulin/social_accounts/types/update_social_accounts_response.py +19 -0
  92. schedulin-0.1.0/schedulin/social_accounts/types/update_timezone_social_accounts_response.py +19 -0
  93. schedulin-0.1.0/schedulin/tags/__init__.py +34 -0
  94. schedulin-0.1.0/schedulin/tags/client.py +348 -0
  95. schedulin-0.1.0/schedulin/tags/raw_client.py +615 -0
  96. schedulin-0.1.0/schedulin/tags/types/__init__.py +34 -0
  97. schedulin-0.1.0/schedulin/tags/types/list_tags_response.py +20 -0
  98. schedulin-0.1.0/schedulin/types/__init__.py +152 -0
  99. schedulin-0.1.0/schedulin/types/analytics_status.py +5 -0
  100. schedulin-0.1.0/schedulin/types/error_response.py +30 -0
  101. schedulin-0.1.0/schedulin/types/image_processing_status.py +5 -0
  102. schedulin-0.1.0/schedulin/types/list_posts_request_scheduled_at.py +24 -0
  103. schedulin-0.1.0/schedulin/types/media.py +37 -0
  104. schedulin-0.1.0/schedulin/types/media_search.py +33 -0
  105. schedulin-0.1.0/schedulin/types/media_search_cursor.py +25 -0
  106. schedulin-0.1.0/schedulin/types/media_search_tag_mode.py +5 -0
  107. schedulin-0.1.0/schedulin/types/media_search_type.py +5 -0
  108. schedulin-0.1.0/schedulin/types/media_set_tags.py +24 -0
  109. schedulin-0.1.0/schedulin/types/media_update.py +29 -0
  110. schedulin-0.1.0/schedulin/types/oauth_scope.py +20 -0
  111. schedulin-0.1.0/schedulin/types/post.py +67 -0
  112. schedulin-0.1.0/schedulin/types/post_approval_status.py +5 -0
  113. schedulin-0.1.0/schedulin/types/post_publish_draft.py +25 -0
  114. schedulin-0.1.0/schedulin/types/post_search.py +46 -0
  115. schedulin-0.1.0/schedulin/types/post_search_approval_status.py +5 -0
  116. schedulin-0.1.0/schedulin/types/post_search_scheduled_at.py +24 -0
  117. schedulin-0.1.0/schedulin/types/post_search_status.py +5 -0
  118. schedulin-0.1.0/schedulin/types/post_search_tag_mode.py +5 -0
  119. schedulin-0.1.0/schedulin/types/post_status.py +5 -0
  120. schedulin-0.1.0/schedulin/types/post_with_relations.py +75 -0
  121. schedulin-0.1.0/schedulin/types/post_with_relations_media_item.py +25 -0
  122. schedulin-0.1.0/schedulin/types/post_with_relations_media_item_tags_item.py +25 -0
  123. schedulin-0.1.0/schedulin/types/post_with_relations_media_item_tags_item_platform.py +20 -0
  124. schedulin-0.1.0/schedulin/types/post_with_relations_media_item_tags_item_type.py +5 -0
  125. schedulin-0.1.0/schedulin/types/presigned_post.py +22 -0
  126. schedulin-0.1.0/schedulin/types/presigned_post_method.py +5 -0
  127. schedulin-0.1.0/schedulin/types/social_account.py +51 -0
  128. schedulin-0.1.0/schedulin/types/social_account_disconnected_reason.py +10 -0
  129. schedulin-0.1.0/schedulin/types/social_account_public.py +33 -0
  130. schedulin-0.1.0/schedulin/types/social_account_public_status.py +5 -0
  131. schedulin-0.1.0/schedulin/types/social_account_status.py +5 -0
  132. schedulin-0.1.0/schedulin/types/social_account_update.py +21 -0
  133. schedulin-0.1.0/schedulin/types/social_account_update_status.py +5 -0
  134. schedulin-0.1.0/schedulin/types/social_platform.py +20 -0
  135. schedulin-0.1.0/schedulin/types/tag.py +30 -0
  136. schedulin-0.1.0/schedulin/types/tag_search.py +20 -0
  137. schedulin-0.1.0/schedulin/types/tag_upsert.py +21 -0
  138. schedulin-0.1.0/schedulin.egg-info/PKG-INFO +205 -0
  139. schedulin-0.1.0/schedulin.egg-info/SOURCES.txt +141 -0
  140. schedulin-0.1.0/schedulin.egg-info/dependency_links.txt +1 -0
  141. schedulin-0.1.0/schedulin.egg-info/requires.txt +3 -0
  142. schedulin-0.1.0/schedulin.egg-info/top_level.txt +1 -0
  143. schedulin-0.1.0/setup.cfg +4 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Schedulin
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,205 @@
1
+ Metadata-Version: 2.2
2
+ Name: schedulin
3
+ Version: 0.1.0
4
+ Summary: Official Python SDK for the Schedulin API (schedulin.app)
5
+ License: MIT
6
+ Project-URL: Homepage, https://developers.schedulin.app
7
+ Project-URL: Repository, https://github.com/schedulin-app/schedulin-py
8
+ Keywords: schedulin,social-media,scheduling,sdk,api
9
+ Requires-Python: >=3.10
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Requires-Dist: httpx>=0.21.2
13
+ Requires-Dist: pydantic>=1.9.2
14
+ Requires-Dist: typing_extensions>=4.0.0
15
+
16
+ # Schedulin Python Library
17
+
18
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=Schedulin%2FPython)
19
+ [![pypi](https://img.shields.io/pypi/v/schedulin)](https://pypi.python.org/pypi/schedulin)
20
+
21
+ The Schedulin Python library provides convenient access to the Schedulin APIs from Python.
22
+
23
+ ## Table of Contents
24
+
25
+ - [Installation](#installation)
26
+ - [Reference](#reference)
27
+ - [Usage](#usage)
28
+ - [Environments](#environments)
29
+ - [Async Client](#async-client)
30
+ - [Exception Handling](#exception-handling)
31
+ - [Advanced](#advanced)
32
+ - [Access Raw Response Data](#access-raw-response-data)
33
+ - [Retries](#retries)
34
+ - [Timeouts](#timeouts)
35
+ - [Custom Client](#custom-client)
36
+ - [Contributing](#contributing)
37
+
38
+ ## Installation
39
+
40
+ ```sh
41
+ pip install schedulin
42
+ ```
43
+
44
+ ## Reference
45
+
46
+ A full reference for this library is available [here](./reference.md).
47
+
48
+ ## Usage
49
+
50
+ Instantiate and use the client with the following:
51
+
52
+ ```python
53
+ from schedulin import Schedulin
54
+
55
+ client = Schedulin(
56
+ api_key="<value>",
57
+ )
58
+
59
+ client.posts.create(
60
+ caption="caption",
61
+ social_account_id="socialAccountId",
62
+ )
63
+ ```
64
+
65
+ ## Environments
66
+
67
+ This SDK allows you to configure different environments for API requests.
68
+
69
+ ```python
70
+ from schedulin import Schedulin
71
+ from schedulin.environment import SchedulinEnvironment
72
+
73
+ client = Schedulin(
74
+ environment=SchedulinEnvironment.DEFAULT,
75
+ )
76
+ ```
77
+
78
+ ## Async Client
79
+
80
+ The SDK also exports an `async` client so that you can make non-blocking calls to our API. Note that if you are constructing an Async httpx client class to pass into this client, use `httpx.AsyncClient()` instead of `httpx.Client()` (e.g. for the `httpx_client` parameter of this client).
81
+
82
+ ```python
83
+ import asyncio
84
+
85
+ from schedulin import AsyncSchedulin
86
+
87
+ client = AsyncSchedulin(
88
+ api_key="<value>",
89
+ )
90
+
91
+
92
+ async def main() -> None:
93
+ await client.posts.create(
94
+ caption="caption",
95
+ social_account_id="socialAccountId",
96
+ )
97
+
98
+
99
+ asyncio.run(main())
100
+ ```
101
+
102
+ ## Exception Handling
103
+
104
+ When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
105
+ will be thrown.
106
+
107
+ ```python
108
+ from schedulin.core.api_error import ApiError
109
+
110
+ try:
111
+ client.posts.create(...)
112
+ except ApiError as e:
113
+ print(e.status_code)
114
+ print(e.body)
115
+ ```
116
+
117
+ ## Advanced
118
+
119
+ ### Access Raw Response Data
120
+
121
+ The SDK provides access to raw response data, including headers, through the `.with_raw_response` property.
122
+ The `.with_raw_response` property returns a "raw" client that can be used to access the `.headers` and `.data` attributes.
123
+
124
+ ```python
125
+ from schedulin import Schedulin
126
+
127
+ client = Schedulin(...)
128
+ response = client.posts.with_raw_response.create(...)
129
+ print(response.headers) # access the response headers
130
+ print(response.status_code) # access the response status code
131
+ print(response.data) # access the underlying object
132
+ ```
133
+
134
+ ### Retries
135
+
136
+ The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
137
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
138
+ retry limit (default: 2).
139
+
140
+ Which status codes are retried depends on the `retryStatusCodes` generator configuration:
141
+
142
+ **`legacy`** (current default): retries on
143
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
144
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
145
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
146
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)
147
+
148
+ **`recommended`**: retries on
149
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
150
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
151
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
152
+ - [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway)
153
+ - [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable)
154
+ - [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout)
155
+
156
+ Use the `max_retries` request option to configure this behavior.
157
+
158
+ ```python
159
+ client.posts.create(..., request_options={
160
+ "max_retries": 1
161
+ })
162
+ ```
163
+
164
+ ### Timeouts
165
+
166
+ The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
167
+
168
+ ```python
169
+ from schedulin import Schedulin
170
+
171
+ client = Schedulin(..., timeout=20.0)
172
+
173
+ # Override timeout for a specific method
174
+ client.posts.create(..., request_options={
175
+ "timeout_in_seconds": 1
176
+ })
177
+ ```
178
+
179
+ ### Custom Client
180
+
181
+ You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
182
+ and transports.
183
+
184
+ ```python
185
+ import httpx
186
+ from schedulin import Schedulin
187
+
188
+ client = Schedulin(
189
+ ...,
190
+ httpx_client=httpx.Client(
191
+ proxy="http://my.test.proxy.example.com",
192
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
193
+ ),
194
+ )
195
+ ```
196
+
197
+ ## Contributing
198
+
199
+ While we value open-source contributions to this SDK, this library is generated programmatically.
200
+ Additions made directly to this library would have to be moved over to our generation code,
201
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
202
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
203
+ an issue first to discuss with us!
204
+
205
+ On the other hand, contributions to the README are always very welcome!
@@ -0,0 +1,190 @@
1
+ # Schedulin Python Library
2
+
3
+ [![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=Schedulin%2FPython)
4
+ [![pypi](https://img.shields.io/pypi/v/schedulin)](https://pypi.python.org/pypi/schedulin)
5
+
6
+ The Schedulin Python library provides convenient access to the Schedulin APIs from Python.
7
+
8
+ ## Table of Contents
9
+
10
+ - [Installation](#installation)
11
+ - [Reference](#reference)
12
+ - [Usage](#usage)
13
+ - [Environments](#environments)
14
+ - [Async Client](#async-client)
15
+ - [Exception Handling](#exception-handling)
16
+ - [Advanced](#advanced)
17
+ - [Access Raw Response Data](#access-raw-response-data)
18
+ - [Retries](#retries)
19
+ - [Timeouts](#timeouts)
20
+ - [Custom Client](#custom-client)
21
+ - [Contributing](#contributing)
22
+
23
+ ## Installation
24
+
25
+ ```sh
26
+ pip install schedulin
27
+ ```
28
+
29
+ ## Reference
30
+
31
+ A full reference for this library is available [here](./reference.md).
32
+
33
+ ## Usage
34
+
35
+ Instantiate and use the client with the following:
36
+
37
+ ```python
38
+ from schedulin import Schedulin
39
+
40
+ client = Schedulin(
41
+ api_key="<value>",
42
+ )
43
+
44
+ client.posts.create(
45
+ caption="caption",
46
+ social_account_id="socialAccountId",
47
+ )
48
+ ```
49
+
50
+ ## Environments
51
+
52
+ This SDK allows you to configure different environments for API requests.
53
+
54
+ ```python
55
+ from schedulin import Schedulin
56
+ from schedulin.environment import SchedulinEnvironment
57
+
58
+ client = Schedulin(
59
+ environment=SchedulinEnvironment.DEFAULT,
60
+ )
61
+ ```
62
+
63
+ ## Async Client
64
+
65
+ The SDK also exports an `async` client so that you can make non-blocking calls to our API. Note that if you are constructing an Async httpx client class to pass into this client, use `httpx.AsyncClient()` instead of `httpx.Client()` (e.g. for the `httpx_client` parameter of this client).
66
+
67
+ ```python
68
+ import asyncio
69
+
70
+ from schedulin import AsyncSchedulin
71
+
72
+ client = AsyncSchedulin(
73
+ api_key="<value>",
74
+ )
75
+
76
+
77
+ async def main() -> None:
78
+ await client.posts.create(
79
+ caption="caption",
80
+ social_account_id="socialAccountId",
81
+ )
82
+
83
+
84
+ asyncio.run(main())
85
+ ```
86
+
87
+ ## Exception Handling
88
+
89
+ When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
90
+ will be thrown.
91
+
92
+ ```python
93
+ from schedulin.core.api_error import ApiError
94
+
95
+ try:
96
+ client.posts.create(...)
97
+ except ApiError as e:
98
+ print(e.status_code)
99
+ print(e.body)
100
+ ```
101
+
102
+ ## Advanced
103
+
104
+ ### Access Raw Response Data
105
+
106
+ The SDK provides access to raw response data, including headers, through the `.with_raw_response` property.
107
+ The `.with_raw_response` property returns a "raw" client that can be used to access the `.headers` and `.data` attributes.
108
+
109
+ ```python
110
+ from schedulin import Schedulin
111
+
112
+ client = Schedulin(...)
113
+ response = client.posts.with_raw_response.create(...)
114
+ print(response.headers) # access the response headers
115
+ print(response.status_code) # access the response status code
116
+ print(response.data) # access the underlying object
117
+ ```
118
+
119
+ ### Retries
120
+
121
+ The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
122
+ as the request is deemed retryable and the number of retry attempts has not grown larger than the configured
123
+ retry limit (default: 2).
124
+
125
+ Which status codes are retried depends on the `retryStatusCodes` generator configuration:
126
+
127
+ **`legacy`** (current default): retries on
128
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
129
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
130
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
131
+ - [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#server_error_responses) (All server errors, including 500)
132
+
133
+ **`recommended`**: retries on
134
+ - [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
135
+ - [409](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409) (Conflict)
136
+ - [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
137
+ - [502](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) (Bad Gateway)
138
+ - [503](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) (Service Unavailable)
139
+ - [504](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504) (Gateway Timeout)
140
+
141
+ Use the `max_retries` request option to configure this behavior.
142
+
143
+ ```python
144
+ client.posts.create(..., request_options={
145
+ "max_retries": 1
146
+ })
147
+ ```
148
+
149
+ ### Timeouts
150
+
151
+ The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
152
+
153
+ ```python
154
+ from schedulin import Schedulin
155
+
156
+ client = Schedulin(..., timeout=20.0)
157
+
158
+ # Override timeout for a specific method
159
+ client.posts.create(..., request_options={
160
+ "timeout_in_seconds": 1
161
+ })
162
+ ```
163
+
164
+ ### Custom Client
165
+
166
+ You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
167
+ and transports.
168
+
169
+ ```python
170
+ import httpx
171
+ from schedulin import Schedulin
172
+
173
+ client = Schedulin(
174
+ ...,
175
+ httpx_client=httpx.Client(
176
+ proxy="http://my.test.proxy.example.com",
177
+ transport=httpx.HTTPTransport(local_address="0.0.0.0"),
178
+ ),
179
+ )
180
+ ```
181
+
182
+ ## Contributing
183
+
184
+ While we value open-source contributions to this SDK, this library is generated programmatically.
185
+ Additions made directly to this library would have to be moved over to our generation code,
186
+ otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
187
+ a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
188
+ an issue first to discuss with us!
189
+
190
+ On the other hand, contributions to the README are always very welcome!
@@ -0,0 +1,34 @@
1
+ # Pin setuptools <77 so it emits Metadata-Version 2.2 (legacy `License:` field)
2
+ # rather than PEP-639 `License-Expression`/`License-File` (2.4), which older
3
+ # twine/packaging on the CI runner rejects as malformed.
4
+ [build-system]
5
+ requires = ["setuptools>=68,<77", "wheel"]
6
+ build-backend = "setuptools.build_meta"
7
+
8
+ [project]
9
+ name = "schedulin"
10
+ version = "0.1.0"
11
+ description = "Official Python SDK for the Schedulin API (schedulin.app)"
12
+ readme = "README.md"
13
+ # Table form (not the bare SPDX string) so setuptools emits a legacy `License:`
14
+ # field instead of PEP-639 `License-Expression`.
15
+ license = { text = "MIT" }
16
+ # The Fern-generated runtime uses PEP-604 (`X | None`) unions evaluated at
17
+ # runtime, which require 3.10+ (fails on 3.8/3.9 with a TypeError on `|`).
18
+ requires-python = ">=3.10"
19
+ keywords = ["schedulin", "social-media", "scheduling", "sdk", "api"]
20
+ dependencies = [
21
+ "httpx>=0.21.2",
22
+ "pydantic>=1.9.2",
23
+ "typing_extensions>=4.0.0",
24
+ ]
25
+
26
+ [project.urls]
27
+ Homepage = "https://developers.schedulin.app"
28
+ Repository = "https://github.com/schedulin-app/schedulin-py"
29
+
30
+ # The generated package source is assembled under ./schedulin/ by
31
+ # scripts/publish-sdk-registries.sh before building.
32
+ [tool.setuptools.packages.find]
33
+ where = ["."]
34
+ include = ["schedulin*"]