magic_hour 0.8.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.

Potentially problematic release.


This version of magic_hour might be problematic. Click here for more details.

Files changed (131) hide show
  1. magic_hour-0.8.0/LICENSE +21 -0
  2. magic_hour-0.8.0/PKG-INFO +138 -0
  3. magic_hour-0.8.0/README.md +119 -0
  4. magic_hour-0.8.0/magic_hour/__init__.py +6 -0
  5. magic_hour-0.8.0/magic_hour/client.py +61 -0
  6. magic_hour-0.8.0/magic_hour/core/__init__.py +53 -0
  7. magic_hour-0.8.0/magic_hour/core/api_error.py +48 -0
  8. magic_hour-0.8.0/magic_hour/core/auth.py +314 -0
  9. magic_hour-0.8.0/magic_hour/core/base_client.py +600 -0
  10. magic_hour-0.8.0/magic_hour/core/binary_response.py +23 -0
  11. magic_hour-0.8.0/magic_hour/core/request.py +158 -0
  12. magic_hour-0.8.0/magic_hour/core/response.py +293 -0
  13. magic_hour-0.8.0/magic_hour/core/type_utils.py +28 -0
  14. magic_hour-0.8.0/magic_hour/core/utils.py +38 -0
  15. magic_hour-0.8.0/magic_hour/environment.py +6 -0
  16. magic_hour-0.8.0/magic_hour/resources/v1/__init__.py +4 -0
  17. magic_hour-0.8.0/magic_hour/resources/v1/ai_clothes_changer/README.md +41 -0
  18. magic_hour-0.8.0/magic_hour/resources/v1/ai_clothes_changer/__init__.py +4 -0
  19. magic_hour-0.8.0/magic_hour/resources/v1/ai_clothes_changer/client.py +129 -0
  20. magic_hour-0.8.0/magic_hour/resources/v1/ai_headshot_generator/README.md +31 -0
  21. magic_hour-0.8.0/magic_hour/resources/v1/ai_headshot_generator/__init__.py +4 -0
  22. magic_hour-0.8.0/magic_hour/resources/v1/ai_headshot_generator/client.py +119 -0
  23. magic_hour-0.8.0/magic_hour/resources/v1/ai_image_generator/README.md +37 -0
  24. magic_hour-0.8.0/magic_hour/resources/v1/ai_image_generator/__init__.py +4 -0
  25. magic_hour-0.8.0/magic_hour/resources/v1/ai_image_generator/client.py +144 -0
  26. magic_hour-0.8.0/magic_hour/resources/v1/ai_image_upscaler/README.md +37 -0
  27. magic_hour-0.8.0/magic_hour/resources/v1/ai_image_upscaler/__init__.py +4 -0
  28. magic_hour-0.8.0/magic_hour/resources/v1/ai_image_upscaler/client.py +143 -0
  29. magic_hour-0.8.0/magic_hour/resources/v1/ai_photo_editor/README.md +53 -0
  30. magic_hour-0.8.0/magic_hour/resources/v1/ai_photo_editor/__init__.py +4 -0
  31. magic_hour-0.8.0/magic_hour/resources/v1/ai_photo_editor/client.py +167 -0
  32. magic_hour-0.8.0/magic_hour/resources/v1/ai_qr_code_generator/README.md +35 -0
  33. magic_hour-0.8.0/magic_hour/resources/v1/ai_qr_code_generator/__init__.py +4 -0
  34. magic_hour-0.8.0/magic_hour/resources/v1/ai_qr_code_generator/client.py +127 -0
  35. magic_hour-0.8.0/magic_hour/resources/v1/animation/README.md +63 -0
  36. magic_hour-0.8.0/magic_hour/resources/v1/animation/__init__.py +4 -0
  37. magic_hour-0.8.0/magic_hour/resources/v1/animation/client.py +179 -0
  38. magic_hour-0.8.0/magic_hour/resources/v1/client.py +153 -0
  39. magic_hour-0.8.0/magic_hour/resources/v1/face_swap/README.md +52 -0
  40. magic_hour-0.8.0/magic_hour/resources/v1/face_swap/__init__.py +4 -0
  41. magic_hour-0.8.0/magic_hour/resources/v1/face_swap/client.py +165 -0
  42. magic_hour-0.8.0/magic_hour/resources/v1/face_swap_photo/README.md +39 -0
  43. magic_hour-0.8.0/magic_hour/resources/v1/face_swap_photo/__init__.py +4 -0
  44. magic_hour-0.8.0/magic_hour/resources/v1/face_swap_photo/client.py +127 -0
  45. magic_hour-0.8.0/magic_hour/resources/v1/files/__init__.py +4 -0
  46. magic_hour-0.8.0/magic_hour/resources/v1/files/client.py +19 -0
  47. magic_hour-0.8.0/magic_hour/resources/v1/files/upload_urls/README.md +56 -0
  48. magic_hour-0.8.0/magic_hour/resources/v1/files/upload_urls/__init__.py +4 -0
  49. magic_hour-0.8.0/magic_hour/resources/v1/files/upload_urls/client.py +142 -0
  50. magic_hour-0.8.0/magic_hour/resources/v1/image_background_remover/README.md +31 -0
  51. magic_hour-0.8.0/magic_hour/resources/v1/image_background_remover/__init__.py +4 -0
  52. magic_hour-0.8.0/magic_hour/resources/v1/image_background_remover/client.py +121 -0
  53. magic_hour-0.8.0/magic_hour/resources/v1/image_projects/README.md +63 -0
  54. magic_hour-0.8.0/magic_hour/resources/v1/image_projects/__init__.py +4 -0
  55. magic_hour-0.8.0/magic_hour/resources/v1/image_projects/client.py +177 -0
  56. magic_hour-0.8.0/magic_hour/resources/v1/image_to_video/README.md +44 -0
  57. magic_hour-0.8.0/magic_hour/resources/v1/image_to_video/__init__.py +4 -0
  58. magic_hour-0.8.0/magic_hour/resources/v1/image_to_video/client.py +165 -0
  59. magic_hour-0.8.0/magic_hour/resources/v1/lip_sync/README.md +54 -0
  60. magic_hour-0.8.0/magic_hour/resources/v1/lip_sync/__init__.py +4 -0
  61. magic_hour-0.8.0/magic_hour/resources/v1/lip_sync/client.py +177 -0
  62. magic_hour-0.8.0/magic_hour/resources/v1/text_to_video/README.md +40 -0
  63. magic_hour-0.8.0/magic_hour/resources/v1/text_to_video/__init__.py +4 -0
  64. magic_hour-0.8.0/magic_hour/resources/v1/text_to_video/client.py +150 -0
  65. magic_hour-0.8.0/magic_hour/resources/v1/video_projects/README.md +63 -0
  66. magic_hour-0.8.0/magic_hour/resources/v1/video_projects/__init__.py +4 -0
  67. magic_hour-0.8.0/magic_hour/resources/v1/video_projects/client.py +177 -0
  68. magic_hour-0.8.0/magic_hour/resources/v1/video_to_video/README.md +60 -0
  69. magic_hour-0.8.0/magic_hour/resources/v1/video_to_video/__init__.py +4 -0
  70. magic_hour-0.8.0/magic_hour/resources/v1/video_to_video/client.py +204 -0
  71. magic_hour-0.8.0/magic_hour/types/models/__init__.py +60 -0
  72. magic_hour-0.8.0/magic_hour/types/models/get_v1_image_projects_id_response.py +82 -0
  73. magic_hour-0.8.0/magic_hour/types/models/get_v1_image_projects_id_response_downloads_item.py +19 -0
  74. magic_hour-0.8.0/magic_hour/types/models/get_v1_image_projects_id_response_error.py +25 -0
  75. magic_hour-0.8.0/magic_hour/types/models/get_v1_video_projects_id_response.py +114 -0
  76. magic_hour-0.8.0/magic_hour/types/models/get_v1_video_projects_id_response_download.py +19 -0
  77. magic_hour-0.8.0/magic_hour/types/models/get_v1_video_projects_id_response_downloads_item.py +19 -0
  78. magic_hour-0.8.0/magic_hour/types/models/get_v1_video_projects_id_response_error.py +25 -0
  79. magic_hour-0.8.0/magic_hour/types/models/post_v1_ai_clothes_changer_response.py +25 -0
  80. magic_hour-0.8.0/magic_hour/types/models/post_v1_ai_headshot_generator_response.py +25 -0
  81. magic_hour-0.8.0/magic_hour/types/models/post_v1_ai_image_generator_response.py +25 -0
  82. magic_hour-0.8.0/magic_hour/types/models/post_v1_ai_image_upscaler_response.py +25 -0
  83. magic_hour-0.8.0/magic_hour/types/models/post_v1_ai_photo_editor_response.py +25 -0
  84. magic_hour-0.8.0/magic_hour/types/models/post_v1_ai_qr_code_generator_response.py +25 -0
  85. magic_hour-0.8.0/magic_hour/types/models/post_v1_animation_response.py +25 -0
  86. magic_hour-0.8.0/magic_hour/types/models/post_v1_face_swap_photo_response.py +25 -0
  87. magic_hour-0.8.0/magic_hour/types/models/post_v1_face_swap_response.py +25 -0
  88. magic_hour-0.8.0/magic_hour/types/models/post_v1_files_upload_urls_response.py +21 -0
  89. magic_hour-0.8.0/magic_hour/types/models/post_v1_files_upload_urls_response_items_item.py +31 -0
  90. magic_hour-0.8.0/magic_hour/types/models/post_v1_image_background_remover_response.py +25 -0
  91. magic_hour-0.8.0/magic_hour/types/models/post_v1_image_to_video_response.py +25 -0
  92. magic_hour-0.8.0/magic_hour/types/models/post_v1_lip_sync_response.py +25 -0
  93. magic_hour-0.8.0/magic_hour/types/models/post_v1_text_to_video_response.py +25 -0
  94. magic_hour-0.8.0/magic_hour/types/models/post_v1_video_to_video_response.py +25 -0
  95. magic_hour-0.8.0/magic_hour/types/params/__init__.py +205 -0
  96. magic_hour-0.8.0/magic_hour/types/params/post_v1_ai_clothes_changer_body.py +40 -0
  97. magic_hour-0.8.0/magic_hour/types/params/post_v1_ai_clothes_changer_body_assets.py +45 -0
  98. magic_hour-0.8.0/magic_hour/types/params/post_v1_ai_headshot_generator_body.py +40 -0
  99. magic_hour-0.8.0/magic_hour/types/params/post_v1_ai_headshot_generator_body_assets.py +28 -0
  100. magic_hour-0.8.0/magic_hour/types/params/post_v1_ai_image_generator_body.py +54 -0
  101. magic_hour-0.8.0/magic_hour/types/params/post_v1_ai_image_generator_body_style.py +28 -0
  102. magic_hour-0.8.0/magic_hour/types/params/post_v1_ai_image_upscaler_body.py +54 -0
  103. magic_hour-0.8.0/magic_hour/types/params/post_v1_ai_image_upscaler_body_assets.py +28 -0
  104. magic_hour-0.8.0/magic_hour/types/params/post_v1_ai_image_upscaler_body_style.py +36 -0
  105. magic_hour-0.8.0/magic_hour/types/params/post_v1_ai_photo_editor_body.py +63 -0
  106. magic_hour-0.8.0/magic_hour/types/params/post_v1_ai_photo_editor_body_assets.py +28 -0
  107. magic_hour-0.8.0/magic_hour/types/params/post_v1_ai_photo_editor_body_style.py +67 -0
  108. magic_hour-0.8.0/magic_hour/types/params/post_v1_ai_qr_code_generator_body.py +45 -0
  109. magic_hour-0.8.0/magic_hour/types/params/post_v1_ai_qr_code_generator_body_style.py +28 -0
  110. magic_hour-0.8.0/magic_hour/types/params/post_v1_animation_body.py +84 -0
  111. magic_hour-0.8.0/magic_hour/types/params/post_v1_animation_body_assets.py +55 -0
  112. magic_hour-0.8.0/magic_hour/types/params/post_v1_animation_body_style.py +279 -0
  113. magic_hour-0.8.0/magic_hour/types/params/post_v1_face_swap_body.py +72 -0
  114. magic_hour-0.8.0/magic_hour/types/params/post_v1_face_swap_body_assets.py +52 -0
  115. magic_hour-0.8.0/magic_hour/types/params/post_v1_face_swap_photo_body.py +40 -0
  116. magic_hour-0.8.0/magic_hour/types/params/post_v1_face_swap_photo_body_assets.py +36 -0
  117. magic_hour-0.8.0/magic_hour/types/params/post_v1_files_upload_urls_body.py +31 -0
  118. magic_hour-0.8.0/magic_hour/types/params/post_v1_files_upload_urls_body_items_item.py +38 -0
  119. magic_hour-0.8.0/magic_hour/types/params/post_v1_image_background_remover_body.py +40 -0
  120. magic_hour-0.8.0/magic_hour/types/params/post_v1_image_background_remover_body_assets.py +28 -0
  121. magic_hour-0.8.0/magic_hour/types/params/post_v1_image_to_video_body.py +73 -0
  122. magic_hour-0.8.0/magic_hour/types/params/post_v1_image_to_video_body_assets.py +28 -0
  123. magic_hour-0.8.0/magic_hour/types/params/post_v1_image_to_video_body_style.py +29 -0
  124. magic_hour-0.8.0/magic_hour/types/params/post_v1_lip_sync_body.py +80 -0
  125. magic_hour-0.8.0/magic_hour/types/params/post_v1_lip_sync_body_assets.py +52 -0
  126. magic_hour-0.8.0/magic_hour/types/params/post_v1_text_to_video_body.py +57 -0
  127. magic_hour-0.8.0/magic_hour/types/params/post_v1_text_to_video_body_style.py +28 -0
  128. magic_hour-0.8.0/magic_hour/types/params/post_v1_video_to_video_body.py +93 -0
  129. magic_hour-0.8.0/magic_hour/types/params/post_v1_video_to_video_body_assets.py +44 -0
  130. magic_hour-0.8.0/magic_hour/types/params/post_v1_video_to_video_body_style.py +199 -0
  131. magic_hour-0.8.0/pyproject.toml +23 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Magic Hour AI
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,138 @@
1
+ Metadata-Version: 2.1
2
+ Name: magic_hour
3
+ Version: 0.8.0
4
+ Summary:
5
+ Requires-Python: >=3.8,<4.0
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Programming Language :: Python :: 3.8
8
+ Classifier: Programming Language :: Python :: 3.9
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Classifier: Programming Language :: Python :: 3.13
13
+ Requires-Dist: httpx (>=0.26.0,<0.27.0)
14
+ Requires-Dist: jsonpointer (>=3.0.0,<4.0.0)
15
+ Requires-Dist: pydantic (>=2.5.0,<3.0.0)
16
+ Requires-Dist: typing_extensions (>=4.0.0,<5.0.0)
17
+ Description-Content-Type: text/markdown
18
+
19
+
20
+ # Magic Hour API Python SDK
21
+
22
+ ## Overview
23
+
24
+ # Introduction
25
+
26
+ Magic Hour provides an API (beta) that can be integrated into your own application to generate videos using AI.
27
+
28
+ Webhook documentation can be found [here](https://magichour.ai/docs/webhook).
29
+
30
+ If you have any questions, please reach out to us via [discord](https://discord.gg/JX5rgsZaJp).
31
+
32
+ # Authentication
33
+
34
+ Every request requires an API key.
35
+
36
+ To get started, first generate your API key [here](https://magichour.ai/settings/developer).
37
+
38
+ Then, add the `Authorization` header to the request.
39
+
40
+ | Key | Value |
41
+ |-|-|
42
+ | Authorization | Bearer mhk_live_apikey |
43
+
44
+ > **Warning**: any API call that renders a video will utilize frames in your account.
45
+
46
+
47
+ ### Synchronous Client
48
+
49
+ ```python
50
+ from magic_hour import Client
51
+ from os import getenv
52
+
53
+ client = Client(token=getenv("API_TOKEN"))
54
+ ```
55
+
56
+ ### Asynchronous Client
57
+
58
+ ```python
59
+ from magic_hour import AsyncClient
60
+ from os import getenv
61
+
62
+ client = AsyncClient(token=getenv("API_TOKEN"))
63
+ ```
64
+
65
+ ## Module Documentation and Snippets
66
+
67
+ ### [v1.ai_clothes_changer](magic_hour/resources/v1/ai_clothes_changer/README.md)
68
+
69
+ * [create](magic_hour/resources/v1/ai_clothes_changer/README.md#create) - AI Clothes Changer
70
+
71
+ ### [v1.ai_headshot_generator](magic_hour/resources/v1/ai_headshot_generator/README.md)
72
+
73
+ * [create](magic_hour/resources/v1/ai_headshot_generator/README.md#create) - AI Headshots
74
+
75
+ ### [v1.ai_image_generator](magic_hour/resources/v1/ai_image_generator/README.md)
76
+
77
+ * [create](magic_hour/resources/v1/ai_image_generator/README.md#create) - AI Images
78
+
79
+ ### [v1.ai_image_upscaler](magic_hour/resources/v1/ai_image_upscaler/README.md)
80
+
81
+ * [create](magic_hour/resources/v1/ai_image_upscaler/README.md#create) - AI Image Upscaler
82
+
83
+ ### [v1.ai_photo_editor](magic_hour/resources/v1/ai_photo_editor/README.md)
84
+
85
+ * [create](magic_hour/resources/v1/ai_photo_editor/README.md#create) - AI Photo Editor
86
+
87
+ ### [v1.ai_qr_code_generator](magic_hour/resources/v1/ai_qr_code_generator/README.md)
88
+
89
+ * [create](magic_hour/resources/v1/ai_qr_code_generator/README.md#create) - AI QR Code
90
+
91
+ ### [v1.animation](magic_hour/resources/v1/animation/README.md)
92
+
93
+ * [create](magic_hour/resources/v1/animation/README.md#create) - Animation
94
+
95
+ ### [v1.face_swap](magic_hour/resources/v1/face_swap/README.md)
96
+
97
+ * [create](magic_hour/resources/v1/face_swap/README.md#create) - Face Swap video
98
+
99
+ ### [v1.face_swap_photo](magic_hour/resources/v1/face_swap_photo/README.md)
100
+
101
+ * [create](magic_hour/resources/v1/face_swap_photo/README.md#create) - Face Swap Photo
102
+
103
+ ### [v1.files.upload_urls](magic_hour/resources/v1/files/upload_urls/README.md)
104
+
105
+ * [create](magic_hour/resources/v1/files/upload_urls/README.md#create) - Generate asset upload urls
106
+
107
+ ### [v1.image_background_remover](magic_hour/resources/v1/image_background_remover/README.md)
108
+
109
+ * [create](magic_hour/resources/v1/image_background_remover/README.md#create) - Image Background Remover
110
+
111
+ ### [v1.image_projects](magic_hour/resources/v1/image_projects/README.md)
112
+
113
+ * [delete](magic_hour/resources/v1/image_projects/README.md#delete) - Delete image
114
+ * [get](magic_hour/resources/v1/image_projects/README.md#get) - Get image details
115
+
116
+ ### [v1.image_to_video](magic_hour/resources/v1/image_to_video/README.md)
117
+
118
+ * [create](magic_hour/resources/v1/image_to_video/README.md#create) - Image-to-Video
119
+
120
+ ### [v1.lip_sync](magic_hour/resources/v1/lip_sync/README.md)
121
+
122
+ * [create](magic_hour/resources/v1/lip_sync/README.md#create) - Lip Sync
123
+
124
+ ### [v1.text_to_video](magic_hour/resources/v1/text_to_video/README.md)
125
+
126
+ * [create](magic_hour/resources/v1/text_to_video/README.md#create) - Text-to-Video
127
+
128
+ ### [v1.video_projects](magic_hour/resources/v1/video_projects/README.md)
129
+
130
+ * [delete](magic_hour/resources/v1/video_projects/README.md#delete) - Delete video
131
+ * [get](magic_hour/resources/v1/video_projects/README.md#get) - Get video details
132
+
133
+ ### [v1.video_to_video](magic_hour/resources/v1/video_to_video/README.md)
134
+
135
+ * [create](magic_hour/resources/v1/video_to_video/README.md#create) - Video-to-Video
136
+
137
+ <!-- MODULE DOCS END -->
138
+
@@ -0,0 +1,119 @@
1
+
2
+ # Magic Hour API Python SDK
3
+
4
+ ## Overview
5
+
6
+ # Introduction
7
+
8
+ Magic Hour provides an API (beta) that can be integrated into your own application to generate videos using AI.
9
+
10
+ Webhook documentation can be found [here](https://magichour.ai/docs/webhook).
11
+
12
+ If you have any questions, please reach out to us via [discord](https://discord.gg/JX5rgsZaJp).
13
+
14
+ # Authentication
15
+
16
+ Every request requires an API key.
17
+
18
+ To get started, first generate your API key [here](https://magichour.ai/settings/developer).
19
+
20
+ Then, add the `Authorization` header to the request.
21
+
22
+ | Key | Value |
23
+ |-|-|
24
+ | Authorization | Bearer mhk_live_apikey |
25
+
26
+ > **Warning**: any API call that renders a video will utilize frames in your account.
27
+
28
+
29
+ ### Synchronous Client
30
+
31
+ ```python
32
+ from magic_hour import Client
33
+ from os import getenv
34
+
35
+ client = Client(token=getenv("API_TOKEN"))
36
+ ```
37
+
38
+ ### Asynchronous Client
39
+
40
+ ```python
41
+ from magic_hour import AsyncClient
42
+ from os import getenv
43
+
44
+ client = AsyncClient(token=getenv("API_TOKEN"))
45
+ ```
46
+
47
+ ## Module Documentation and Snippets
48
+
49
+ ### [v1.ai_clothes_changer](magic_hour/resources/v1/ai_clothes_changer/README.md)
50
+
51
+ * [create](magic_hour/resources/v1/ai_clothes_changer/README.md#create) - AI Clothes Changer
52
+
53
+ ### [v1.ai_headshot_generator](magic_hour/resources/v1/ai_headshot_generator/README.md)
54
+
55
+ * [create](magic_hour/resources/v1/ai_headshot_generator/README.md#create) - AI Headshots
56
+
57
+ ### [v1.ai_image_generator](magic_hour/resources/v1/ai_image_generator/README.md)
58
+
59
+ * [create](magic_hour/resources/v1/ai_image_generator/README.md#create) - AI Images
60
+
61
+ ### [v1.ai_image_upscaler](magic_hour/resources/v1/ai_image_upscaler/README.md)
62
+
63
+ * [create](magic_hour/resources/v1/ai_image_upscaler/README.md#create) - AI Image Upscaler
64
+
65
+ ### [v1.ai_photo_editor](magic_hour/resources/v1/ai_photo_editor/README.md)
66
+
67
+ * [create](magic_hour/resources/v1/ai_photo_editor/README.md#create) - AI Photo Editor
68
+
69
+ ### [v1.ai_qr_code_generator](magic_hour/resources/v1/ai_qr_code_generator/README.md)
70
+
71
+ * [create](magic_hour/resources/v1/ai_qr_code_generator/README.md#create) - AI QR Code
72
+
73
+ ### [v1.animation](magic_hour/resources/v1/animation/README.md)
74
+
75
+ * [create](magic_hour/resources/v1/animation/README.md#create) - Animation
76
+
77
+ ### [v1.face_swap](magic_hour/resources/v1/face_swap/README.md)
78
+
79
+ * [create](magic_hour/resources/v1/face_swap/README.md#create) - Face Swap video
80
+
81
+ ### [v1.face_swap_photo](magic_hour/resources/v1/face_swap_photo/README.md)
82
+
83
+ * [create](magic_hour/resources/v1/face_swap_photo/README.md#create) - Face Swap Photo
84
+
85
+ ### [v1.files.upload_urls](magic_hour/resources/v1/files/upload_urls/README.md)
86
+
87
+ * [create](magic_hour/resources/v1/files/upload_urls/README.md#create) - Generate asset upload urls
88
+
89
+ ### [v1.image_background_remover](magic_hour/resources/v1/image_background_remover/README.md)
90
+
91
+ * [create](magic_hour/resources/v1/image_background_remover/README.md#create) - Image Background Remover
92
+
93
+ ### [v1.image_projects](magic_hour/resources/v1/image_projects/README.md)
94
+
95
+ * [delete](magic_hour/resources/v1/image_projects/README.md#delete) - Delete image
96
+ * [get](magic_hour/resources/v1/image_projects/README.md#get) - Get image details
97
+
98
+ ### [v1.image_to_video](magic_hour/resources/v1/image_to_video/README.md)
99
+
100
+ * [create](magic_hour/resources/v1/image_to_video/README.md#create) - Image-to-Video
101
+
102
+ ### [v1.lip_sync](magic_hour/resources/v1/lip_sync/README.md)
103
+
104
+ * [create](magic_hour/resources/v1/lip_sync/README.md#create) - Lip Sync
105
+
106
+ ### [v1.text_to_video](magic_hour/resources/v1/text_to_video/README.md)
107
+
108
+ * [create](magic_hour/resources/v1/text_to_video/README.md#create) - Text-to-Video
109
+
110
+ ### [v1.video_projects](magic_hour/resources/v1/video_projects/README.md)
111
+
112
+ * [delete](magic_hour/resources/v1/video_projects/README.md#delete) - Delete video
113
+ * [get](magic_hour/resources/v1/video_projects/README.md#get) - Get video details
114
+
115
+ ### [v1.video_to_video](magic_hour/resources/v1/video_to_video/README.md)
116
+
117
+ * [create](magic_hour/resources/v1/video_to_video/README.md#create) - Video-to-Video
118
+
119
+ <!-- MODULE DOCS END -->
@@ -0,0 +1,6 @@
1
+ from .core import ApiError, BinaryResponse
2
+ from .client import AsyncClient, Client
3
+ from .environment import Environment
4
+
5
+
6
+ __all__ = ["ApiError", "AsyncClient", "BinaryResponse", "Client", "Environment"]
@@ -0,0 +1,61 @@
1
+ import httpx
2
+ import typing
3
+
4
+ from magic_hour.core import AsyncBaseClient, AuthBearer, SyncBaseClient
5
+ from magic_hour.environment import Environment
6
+ from magic_hour.resources.v1 import AsyncV1Client, V1Client
7
+
8
+
9
+ class Client:
10
+ def __init__(
11
+ self,
12
+ *,
13
+ base_url: typing.Optional[str] = None,
14
+ timeout: typing.Optional[float] = 60,
15
+ httpx_client: typing.Optional[httpx.Client] = None,
16
+ environment: Environment = Environment.ENVIRONMENT,
17
+ token: typing.Optional[str] = None,
18
+ ):
19
+ self._base_client = SyncBaseClient(
20
+ base_url=_get_base_url(base_url=base_url, environment=environment),
21
+ httpx_client=(
22
+ httpx.Client(timeout=timeout) if httpx_client is None else httpx_client
23
+ ),
24
+ )
25
+
26
+ self.v1 = V1Client(base_client=self._base_client)
27
+ self._base_client.register_auth("bearerAuth", AuthBearer(val=token))
28
+
29
+
30
+ class AsyncClient:
31
+ def __init__(
32
+ self,
33
+ *,
34
+ base_url: typing.Optional[str] = None,
35
+ timeout: typing.Optional[float] = 60,
36
+ httpx_client: typing.Optional[httpx.AsyncClient] = None,
37
+ environment: Environment = Environment.ENVIRONMENT,
38
+ token: typing.Optional[str] = None,
39
+ ):
40
+ self._base_client = AsyncBaseClient(
41
+ base_url=_get_base_url(base_url=base_url, environment=environment),
42
+ httpx_client=(
43
+ httpx.AsyncClient(timeout=timeout)
44
+ if httpx_client is None
45
+ else httpx_client
46
+ ),
47
+ )
48
+
49
+ self.v1 = AsyncV1Client(base_client=self._base_client)
50
+ self._base_client.register_auth("bearerAuth", AuthBearer(val=token))
51
+
52
+
53
+ def _get_base_url(
54
+ *, base_url: typing.Optional[str] = None, environment: Environment
55
+ ) -> str:
56
+ if base_url is not None:
57
+ return base_url
58
+ elif environment is not None:
59
+ return environment.value
60
+ else:
61
+ raise Exception("Must include a base_url or environment arguments")
@@ -0,0 +1,53 @@
1
+ from .api_error import ApiError
2
+ from .auth import (
3
+ AuthKeyQuery,
4
+ AuthBasic,
5
+ AuthBearer,
6
+ AuthProvider,
7
+ AuthKeyCookie,
8
+ AuthKeyHeader,
9
+ GrantType,
10
+ OAuth2,
11
+ OAuth2ClientCredentialsForm,
12
+ OAuth2PasswordForm,
13
+ )
14
+ from .base_client import AsyncBaseClient, BaseClient, SyncBaseClient
15
+ from .binary_response import BinaryResponse
16
+ from .request import (
17
+ encode_param,
18
+ filter_not_given,
19
+ to_content,
20
+ to_encodable,
21
+ RequestOptions,
22
+ default_request_options,
23
+ QueryParams,
24
+ )
25
+ from .response import from_encodable, AsyncStreamResponse, StreamResponse
26
+
27
+ __all__ = [
28
+ "ApiError",
29
+ "AsyncBaseClient",
30
+ "BaseClient",
31
+ "BinaryResponse",
32
+ "RequestOptions",
33
+ "default_request_options",
34
+ "SyncBaseClient",
35
+ "AuthKeyQuery",
36
+ "AuthBasic",
37
+ "AuthBearer",
38
+ "AuthProvider",
39
+ "AuthKeyCookie",
40
+ "AuthKeyHeader",
41
+ "GrantType",
42
+ "OAuth2",
43
+ "OAuth2ClientCredentialsForm",
44
+ "OAuth2PasswordForm",
45
+ "to_encodable",
46
+ "filter_not_given",
47
+ "to_content",
48
+ "encode_param",
49
+ "from_encodable",
50
+ "AsyncStreamResponse",
51
+ "StreamResponse",
52
+ "QueryParams",
53
+ ]
@@ -0,0 +1,48 @@
1
+ import typing
2
+
3
+
4
+ class ApiError(Exception):
5
+ """
6
+ A custom exception class for handling API-related errors.
7
+
8
+ This class extends the base Exception class to provide additional context
9
+ for API errors, including the HTTP status code and response body.
10
+
11
+ Attributes:
12
+ status_code: The HTTP status code associated with the error.
13
+ None if no status code is applicable.
14
+ body: The response body or error message content.
15
+ Can be any type depending on the API response format.
16
+ """
17
+
18
+ status_code: typing.Optional[int]
19
+ body: typing.Any
20
+
21
+ def __init__(
22
+ self, *, status_code: typing.Optional[int] = None, body: typing.Any = None
23
+ ) -> None:
24
+ """
25
+ Initialize the ApiError with optional status code and body.
26
+
27
+ Args:
28
+ status_code: The HTTP status code of the error.
29
+ Defaults to None.
30
+ body: The response body or error message content.
31
+ Defaults to None.
32
+
33
+ Note:
34
+ The asterisk (*) in the parameters forces keyword arguments,
35
+ making the instantiation more explicit.
36
+ """
37
+ self.status_code = status_code
38
+ self.body = body
39
+
40
+ def __str__(self) -> str:
41
+ """
42
+ Return a string representation of the ApiError.
43
+
44
+ Returns:
45
+ str: A formatted string containing the status code and body.
46
+ Format: "status_code: {status_code}, body: {body}"
47
+ """
48
+ return f"status_code: {self.status_code}, body: {self.body}"