typecast-python 0.3.1__tar.gz → 0.3.3__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.
@@ -89,6 +89,12 @@ Makefile
89
89
  !typecast-java/Makefile
90
90
  !typecast-rust/Makefile
91
91
  !typecast-kotlin/Makefile
92
+ !typecast-dart/Makefile
93
+ !typecast-dart/lib/
94
+ !typecast-dart/lib/**
95
+ !typecast-ruby/Makefile
96
+ !typecast-ruby/lib/
97
+ !typecast-ruby/lib/**
92
98
  *.cmake
93
99
 
94
100
  # Compiled objects
@@ -233,6 +239,13 @@ out/
233
239
  Cargo.lock
234
240
  *~
235
241
 
242
+ # ----------------
243
+ # Ruby
244
+ # ----------------
245
+ .bundle/
246
+ Gemfile.lock
247
+ vendor/bundle/
248
+
236
249
  # ----------------
237
250
  # Swift
238
251
  # ----------------
@@ -282,6 +295,12 @@ fastlane/test_output
282
295
  # Code Injection
283
296
  iOSInjectionProject/
284
297
 
298
+ # ----------------
299
+ # Dart
300
+ # ----------------
301
+ .dart_tool/
302
+ pubspec.lock
303
+
285
304
  # ----------------
286
305
  # IDE / Editor
287
306
  # ----------------
@@ -326,4 +345,4 @@ logs/
326
345
  # ----------------
327
346
  .npmrc
328
347
  openapi.json
329
- PR.md
348
+ PR.md
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: typecast-python
3
- Version: 0.3.1
3
+ Version: 0.3.3
4
4
  Summary: Official Typecast Python SDK - Convert text to lifelike speech using AI-powered voices
5
5
  Project-URL: Homepage, https://typecast.ai
6
6
  Project-URL: Documentation, https://typecast.ai/docs/overview
@@ -223,7 +223,7 @@ Classifier: Programming Language :: Python :: 3.13
223
223
  Classifier: Topic :: Multimedia :: Sound/Audio :: Speech
224
224
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
225
225
  Requires-Python: >=3.11
226
- Requires-Dist: aiohttp>=3.8.0
226
+ Requires-Dist: aiohttp>=3.14.0
227
227
  Requires-Dist: pydantic>=2.0.0
228
228
  Requires-Dist: requests>=2.28.0
229
229
  Requires-Dist: typing-extensions>=4.0.0
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "typecast-python"
7
- version = "0.3.1"
7
+ version = "0.3.3"
8
8
  description = "Official Typecast Python SDK - Convert text to lifelike speech using AI-powered voices"
9
9
  authors = [
10
10
  {name = "Neosapience", email = "help@typecast.ai"}
@@ -29,7 +29,7 @@ classifiers = [
29
29
  "Operating System :: OS Independent",
30
30
  ]
31
31
  dependencies = [
32
- "aiohttp>=3.8.0",
32
+ "aiohttp>=3.14.0",
33
33
  "requests>=2.28.0",
34
34
  "pydantic>=2.0.0",
35
35
  "typing-extensions>=4.0.0",
@@ -68,6 +68,8 @@ class AsyncTypecast:
68
68
  """
69
69
  self.host = conf.get_host(host)
70
70
  self.api_key = conf.get_api_key(api_key)
71
+ if not self.api_key and conf.is_default_host(self.host):
72
+ raise ValueError("API key is required for the default Typecast API host")
71
73
  self.session: Optional[aiohttp.ClientSession] = None
72
74
 
73
75
  async def __aenter__(self):
@@ -77,10 +77,13 @@ class Typecast:
77
77
  """
78
78
  self.host = conf.get_host(host)
79
79
  self.api_key = conf.get_api_key(api_key)
80
+ if not self.api_key and conf.is_default_host(self.host):
81
+ raise ValueError("API key is required for the default Typecast API host")
80
82
  self.session = requests.Session()
81
- self.session.headers.update(
82
- {"X-API-KEY": self.api_key, "Content-Type": "application/json"}
83
- )
83
+ headers = {"Content-Type": "application/json"}
84
+ if self.api_key:
85
+ headers["X-API-KEY"] = self.api_key
86
+ self.session.headers.update(headers)
84
87
 
85
88
  def _handle_error(self, status_code: int, response_text: str):
86
89
  """Handle HTTP error responses with specific exception types."""
@@ -0,0 +1,25 @@
1
+ import os
2
+
3
+ TYPECAST_API_HOST = "https://api.typecast.ai"
4
+
5
+
6
+ def get_host(host=None):
7
+ if host: # Parameter takes priority
8
+ return normalize_host(host)
9
+ env_host = os.getenv("TYPECAST_API_HOST") # Check environment variable
10
+ return normalize_host(env_host) if env_host else TYPECAST_API_HOST # Use default if not set
11
+
12
+
13
+ def get_api_key(api_key=None):
14
+ if api_key: # Parameter takes priority
15
+ return api_key.strip()
16
+ env_key = os.getenv("TYPECAST_API_KEY") # Return from environment variable
17
+ return env_key.strip() if env_key else None
18
+
19
+
20
+ def normalize_host(host):
21
+ return host.strip().rstrip("/")
22
+
23
+
24
+ def is_default_host(host):
25
+ return normalize_host(host).lower() == TYPECAST_API_HOST
@@ -1,16 +0,0 @@
1
- import os
2
-
3
- TYPECAST_API_HOST = "https://api.typecast.ai"
4
-
5
-
6
- def get_host(host=None):
7
- if host: # Parameter takes priority
8
- return host
9
- env_host = os.getenv("TYPECAST_API_HOST") # Check environment variable
10
- return env_host if env_host else TYPECAST_API_HOST # Use default if not set
11
-
12
-
13
- def get_api_key(api_key=None):
14
- if api_key: # Parameter takes priority
15
- return api_key
16
- return os.getenv("TYPECAST_API_KEY") # Return from environment variable
File without changes