convertintomp4 1.0.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.
@@ -0,0 +1,228 @@
1
+ Metadata-Version: 2.4
2
+ Name: convertintomp4
3
+ Version: 1.0.0
4
+ Summary: Official Python SDK for the ConvertIntoMP4 file conversion API
5
+ Home-page: https://convertintomp4.com
6
+ Author: ConvertIntoMP4
7
+ Author-email: ConvertIntoMP4 <support@convertintomp4.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://convertintomp4.com
10
+ Project-URL: Documentation, https://convertintomp4.com/api-docs
11
+ Keywords: convertintomp4,file-conversion,video,audio,image,pdf,api,sdk
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.8
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: Multimedia :: Video :: Conversion
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Typing :: Typed
24
+ Requires-Python: >=3.8
25
+ Description-Content-Type: text/markdown
26
+ Requires-Dist: requests>=2.28.0
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.0; extra == "dev"
29
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
30
+ Requires-Dist: mypy>=1.0; extra == "dev"
31
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
32
+ Requires-Dist: types-requests>=2.28.0; extra == "dev"
33
+ Dynamic: author
34
+ Dynamic: home-page
35
+ Dynamic: requires-python
36
+
37
+ # ConvertIntoMP4 Python SDK
38
+
39
+ Official Python SDK for the [ConvertIntoMP4](https://convertintomp4.com) file conversion API.
40
+
41
+ ## Installation
42
+
43
+ ```bash
44
+ pip install convertintomp4
45
+ ```
46
+
47
+ ## Requirements
48
+
49
+ - Python 3.8+
50
+ - `requests` library
51
+
52
+ ## Quick Start
53
+
54
+ ```python
55
+ from convertintomp4 import Client
56
+
57
+ client = Client(api_key="your-api-key")
58
+
59
+ # Quick convert a file
60
+ with open("video.mp4", "rb") as f:
61
+ result = client.convert(f, "webm")
62
+ print(f"Job ID: {result['jobId']}")
63
+ ```
64
+
65
+ ## Configuration
66
+
67
+ ```python
68
+ client = Client(
69
+ api_key="your-api-key",
70
+ base_url="https://api.convertintomp4.com/v1", # default
71
+ sandbox=False, # set to True for sandbox
72
+ timeout=30, # request timeout in seconds
73
+ )
74
+ ```
75
+
76
+ ## Usage
77
+
78
+ ### Job-Based Conversion
79
+
80
+ ```python
81
+ job = client.create_job({
82
+ "tasks": {
83
+ "import-file": {
84
+ "operation": "import/url",
85
+ "url": "https://example.com/video.mp4",
86
+ },
87
+ "convert": {
88
+ "operation": "convert",
89
+ "input": "import-file",
90
+ "output_format": "webm",
91
+ "options": {"quality": "high"},
92
+ },
93
+ "export": {
94
+ "operation": "export/url",
95
+ "input": "convert",
96
+ },
97
+ }
98
+ })
99
+
100
+ # Wait for completion
101
+ completed = client.wait_for_job(job.id, interval=2.0, timeout=120.0)
102
+ print(f"Status: {completed.status}")
103
+ ```
104
+
105
+ ### Import from URL
106
+
107
+ ```python
108
+ result = client.import_from_url(
109
+ "https://example.com/video.mp4",
110
+ target_format="webm",
111
+ quality="high",
112
+ )
113
+ ```
114
+
115
+ ### Manage Jobs
116
+
117
+ ```python
118
+ # List jobs
119
+ result = client.list_jobs(status="completed", limit=10)
120
+ for job in result["data"]:
121
+ print(f"{job.id}: {job.status}")
122
+
123
+ # Get job details
124
+ job = client.get_job("job_abc123")
125
+
126
+ # Delete a job
127
+ client.delete_job("job_abc123")
128
+
129
+ # Cancel / retry
130
+ client.cancel_job("job_abc123")
131
+ client.retry_job("job_abc123")
132
+ ```
133
+
134
+ ### Download Converted File
135
+
136
+ ```python
137
+ data = client.download_file("job_abc123")
138
+ with open("output.webm", "wb") as f:
139
+ f.write(data)
140
+ ```
141
+
142
+ ### Formats
143
+
144
+ ```python
145
+ formats = client.list_formats(category="video")
146
+ options = client.get_format_options("mp4", "webm")
147
+ ```
148
+
149
+ ### Webhooks
150
+
151
+ ```python
152
+ webhook = client.create_webhook(
153
+ url="https://your-app.com/webhook",
154
+ events=["job.completed", "job.failed"],
155
+ secret="your-secret",
156
+ )
157
+
158
+ webhooks = client.list_webhooks()
159
+ client.delete_webhook(webhook.id)
160
+ ```
161
+
162
+ ### PDF Operations
163
+
164
+ ```python
165
+ # OCR
166
+ result = client.pdf_ocr("https://example.com/scan.pdf", language="eng")
167
+
168
+ # Split
169
+ parts = client.pdf_split("https://example.com/doc.pdf", ranges=["1-3", "4-6"])
170
+
171
+ # Merge
172
+ merged = client.pdf_merge(["https://example.com/a.pdf", "https://example.com/b.pdf"])
173
+
174
+ # Encrypt / Decrypt
175
+ client.pdf_encrypt("https://example.com/doc.pdf", password="secret")
176
+ client.pdf_decrypt("https://example.com/doc.pdf", password="secret")
177
+
178
+ # Compress
179
+ client.pdf_compress("https://example.com/doc.pdf")
180
+
181
+ # Watermark
182
+ client.pdf_watermark("https://example.com/doc.pdf", text="DRAFT", opacity=0.3)
183
+
184
+ # Extract pages
185
+ client.pdf_extract_pages("https://example.com/doc.pdf", pages=[1, 3, 5])
186
+
187
+ # Rotate
188
+ client.pdf_rotate("https://example.com/doc.pdf", angle=90, pages=[2, 4])
189
+
190
+ # Convert to PDF/A
191
+ client.pdf_to_pdfa("https://example.com/doc.pdf")
192
+ ```
193
+
194
+ ## Error Handling
195
+
196
+ ```python
197
+ from convertintomp4 import (
198
+ Client,
199
+ ApiError,
200
+ AuthenticationError,
201
+ RateLimitError,
202
+ TimeoutError,
203
+ )
204
+
205
+ try:
206
+ job = client.get_job("invalid-id")
207
+ except AuthenticationError:
208
+ print("Invalid API key")
209
+ except RateLimitError as e:
210
+ print(f"Rate limited. Retry after {e.retry_after}s")
211
+ except TimeoutError:
212
+ print("Request timed out")
213
+ except ApiError as e:
214
+ print(f"API error {e.status_code}: {e.code} - {e.message}")
215
+ ```
216
+
217
+ ## Context Manager
218
+
219
+ The client can be used as a context manager to ensure the HTTP session is properly closed:
220
+
221
+ ```python
222
+ with Client(api_key="your-api-key") as client:
223
+ job = client.create_job(...)
224
+ ```
225
+
226
+ ## License
227
+
228
+ MIT
@@ -0,0 +1,192 @@
1
+ # ConvertIntoMP4 Python SDK
2
+
3
+ Official Python SDK for the [ConvertIntoMP4](https://convertintomp4.com) file conversion API.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pip install convertintomp4
9
+ ```
10
+
11
+ ## Requirements
12
+
13
+ - Python 3.8+
14
+ - `requests` library
15
+
16
+ ## Quick Start
17
+
18
+ ```python
19
+ from convertintomp4 import Client
20
+
21
+ client = Client(api_key="your-api-key")
22
+
23
+ # Quick convert a file
24
+ with open("video.mp4", "rb") as f:
25
+ result = client.convert(f, "webm")
26
+ print(f"Job ID: {result['jobId']}")
27
+ ```
28
+
29
+ ## Configuration
30
+
31
+ ```python
32
+ client = Client(
33
+ api_key="your-api-key",
34
+ base_url="https://api.convertintomp4.com/v1", # default
35
+ sandbox=False, # set to True for sandbox
36
+ timeout=30, # request timeout in seconds
37
+ )
38
+ ```
39
+
40
+ ## Usage
41
+
42
+ ### Job-Based Conversion
43
+
44
+ ```python
45
+ job = client.create_job({
46
+ "tasks": {
47
+ "import-file": {
48
+ "operation": "import/url",
49
+ "url": "https://example.com/video.mp4",
50
+ },
51
+ "convert": {
52
+ "operation": "convert",
53
+ "input": "import-file",
54
+ "output_format": "webm",
55
+ "options": {"quality": "high"},
56
+ },
57
+ "export": {
58
+ "operation": "export/url",
59
+ "input": "convert",
60
+ },
61
+ }
62
+ })
63
+
64
+ # Wait for completion
65
+ completed = client.wait_for_job(job.id, interval=2.0, timeout=120.0)
66
+ print(f"Status: {completed.status}")
67
+ ```
68
+
69
+ ### Import from URL
70
+
71
+ ```python
72
+ result = client.import_from_url(
73
+ "https://example.com/video.mp4",
74
+ target_format="webm",
75
+ quality="high",
76
+ )
77
+ ```
78
+
79
+ ### Manage Jobs
80
+
81
+ ```python
82
+ # List jobs
83
+ result = client.list_jobs(status="completed", limit=10)
84
+ for job in result["data"]:
85
+ print(f"{job.id}: {job.status}")
86
+
87
+ # Get job details
88
+ job = client.get_job("job_abc123")
89
+
90
+ # Delete a job
91
+ client.delete_job("job_abc123")
92
+
93
+ # Cancel / retry
94
+ client.cancel_job("job_abc123")
95
+ client.retry_job("job_abc123")
96
+ ```
97
+
98
+ ### Download Converted File
99
+
100
+ ```python
101
+ data = client.download_file("job_abc123")
102
+ with open("output.webm", "wb") as f:
103
+ f.write(data)
104
+ ```
105
+
106
+ ### Formats
107
+
108
+ ```python
109
+ formats = client.list_formats(category="video")
110
+ options = client.get_format_options("mp4", "webm")
111
+ ```
112
+
113
+ ### Webhooks
114
+
115
+ ```python
116
+ webhook = client.create_webhook(
117
+ url="https://your-app.com/webhook",
118
+ events=["job.completed", "job.failed"],
119
+ secret="your-secret",
120
+ )
121
+
122
+ webhooks = client.list_webhooks()
123
+ client.delete_webhook(webhook.id)
124
+ ```
125
+
126
+ ### PDF Operations
127
+
128
+ ```python
129
+ # OCR
130
+ result = client.pdf_ocr("https://example.com/scan.pdf", language="eng")
131
+
132
+ # Split
133
+ parts = client.pdf_split("https://example.com/doc.pdf", ranges=["1-3", "4-6"])
134
+
135
+ # Merge
136
+ merged = client.pdf_merge(["https://example.com/a.pdf", "https://example.com/b.pdf"])
137
+
138
+ # Encrypt / Decrypt
139
+ client.pdf_encrypt("https://example.com/doc.pdf", password="secret")
140
+ client.pdf_decrypt("https://example.com/doc.pdf", password="secret")
141
+
142
+ # Compress
143
+ client.pdf_compress("https://example.com/doc.pdf")
144
+
145
+ # Watermark
146
+ client.pdf_watermark("https://example.com/doc.pdf", text="DRAFT", opacity=0.3)
147
+
148
+ # Extract pages
149
+ client.pdf_extract_pages("https://example.com/doc.pdf", pages=[1, 3, 5])
150
+
151
+ # Rotate
152
+ client.pdf_rotate("https://example.com/doc.pdf", angle=90, pages=[2, 4])
153
+
154
+ # Convert to PDF/A
155
+ client.pdf_to_pdfa("https://example.com/doc.pdf")
156
+ ```
157
+
158
+ ## Error Handling
159
+
160
+ ```python
161
+ from convertintomp4 import (
162
+ Client,
163
+ ApiError,
164
+ AuthenticationError,
165
+ RateLimitError,
166
+ TimeoutError,
167
+ )
168
+
169
+ try:
170
+ job = client.get_job("invalid-id")
171
+ except AuthenticationError:
172
+ print("Invalid API key")
173
+ except RateLimitError as e:
174
+ print(f"Rate limited. Retry after {e.retry_after}s")
175
+ except TimeoutError:
176
+ print("Request timed out")
177
+ except ApiError as e:
178
+ print(f"API error {e.status_code}: {e.code} - {e.message}")
179
+ ```
180
+
181
+ ## Context Manager
182
+
183
+ The client can be used as a context manager to ensure the HTTP session is properly closed:
184
+
185
+ ```python
186
+ with Client(api_key="your-api-key") as client:
187
+ job = client.create_job(...)
188
+ ```
189
+
190
+ ## License
191
+
192
+ MIT
@@ -0,0 +1,49 @@
1
+ """ConvertIntoMP4 - Official Python SDK for the ConvertIntoMP4 file conversion API."""
2
+
3
+ from .client import Client
4
+ from .exceptions import (
5
+ ApiError,
6
+ AuthenticationError,
7
+ ConvertIntoMP4Error,
8
+ NotFoundError,
9
+ RateLimitError,
10
+ TimeoutError,
11
+ ValidationError,
12
+ )
13
+ from .types import (
14
+ ConversionOptions,
15
+ Format,
16
+ FormatOption,
17
+ Job,
18
+ PdfOperationResult,
19
+ PdfPermissions,
20
+ Task,
21
+ TaskResult,
22
+ TaskResultFile,
23
+ WaitOptions,
24
+ Webhook,
25
+ )
26
+
27
+ __version__ = "1.0.0"
28
+
29
+ __all__ = [
30
+ "Client",
31
+ "ApiError",
32
+ "AuthenticationError",
33
+ "ConvertIntoMP4Error",
34
+ "NotFoundError",
35
+ "RateLimitError",
36
+ "TimeoutError",
37
+ "ValidationError",
38
+ "ConversionOptions",
39
+ "Format",
40
+ "FormatOption",
41
+ "Job",
42
+ "PdfOperationResult",
43
+ "PdfPermissions",
44
+ "Task",
45
+ "TaskResult",
46
+ "TaskResultFile",
47
+ "WaitOptions",
48
+ "Webhook",
49
+ ]