upload-post 0.1.0__tar.gz → 0.1.2__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,143 @@
1
+ Metadata-Version: 2.4
2
+ Name: upload-post
3
+ Version: 0.1.2
4
+ Summary: Python client for Upload-Post.com API
5
+ Home-page: https://www.upload-post.com/
6
+ Author: Manuel Gracia
7
+ Author-email: hi@img2html.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: requests>=2.25.1
14
+ Requires-Dist: python-dotenv>=0.19.0
15
+ Dynamic: author
16
+ Dynamic: author-email
17
+ Dynamic: classifier
18
+ Dynamic: description
19
+ Dynamic: description-content-type
20
+ Dynamic: home-page
21
+ Dynamic: requires-dist
22
+ Dynamic: requires-python
23
+ Dynamic: summary
24
+
25
+ # upload-post Python Client
26
+
27
+ A Python client for the [Upload-Post.com](https://www.upload-post.com/) API, designed to facilitate interaction with the service. Upload-Post.com allows you to upload videos to multiple social media platforms simultaneously.
28
+
29
+ [![PyPI version](https://img.shields.io/pypi/v/upload-post.svg)](https://pypi.org/project/upload-post/)
30
+ [![Python Versions](https://img.shields.io/pypi/pyversions/upload-post.svg)](https://pypi.org/project/upload-post/)
31
+
32
+ ## Features
33
+
34
+ - 🚀 Upload videos to TikTok, Instagram, LinkedIn, YouTube, Facebook, X (Twitter), Threads, and Pinterest (platform support based on API availability)
35
+ - 🖼️ Upload photos to TikTok, Instagram, LinkedIn, Facebook, X (Twitter), Threads, and Pinterest
36
+ - ✍️ Upload text posts to LinkedIn, X (Twitter), Facebook, and Threads
37
+ - 🔒 Secure API key authentication
38
+ - 📁 File validation and error handling
39
+ - 📊 Detailed logging
40
+ - 🤖 Both CLI and Python API interfaces
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ pip install upload-post
46
+ ```
47
+
48
+ ## Usage
49
+
50
+ ### Command Line Interface
51
+
52
+ ```bash
53
+ upload-post \
54
+ --api-key "your_api_key_here" \
55
+ --video "/path/to/video.mp4" \
56
+ --title "My Awesome Video" \
57
+ --user "testuser" \
58
+ --platforms tiktok instagram
59
+ ```
60
+
61
+ ### Python API
62
+
63
+ ```python
64
+ from upload_post import UploadPostClient, UploadPostError
65
+ from pathlib import Path
66
+
67
+ # Initialize client
68
+ client = UploadPostClient(api_key="your_api_key_here")
69
+
70
+ # Example: Upload a video
71
+ try:
72
+ response_video = client.upload_video(
73
+ video_path="/path/to/video.mp4", # Can also be a URL: "https://example.com/video.mp4"
74
+ title="My Awesome Video",
75
+ user="testuser",
76
+ platforms=["tiktok", "youtube", "linkedin"],
77
+ # TikTok specific
78
+ privacy_level="PUBLIC_TO_EVERYONE",
79
+ disable_comment=False,
80
+ # YouTube specific
81
+ description="Detailed description for YouTube",
82
+ tags=["tutorial", "python", "api"],
83
+ categoryId="22", # "People & Blogs"
84
+ privacyStatus="public",
85
+ # LinkedIn specific
86
+ visibility="PUBLIC", # Required for LinkedIn if not using default
87
+ description="Post commentary for LinkedIn" # Optional, uses title if not set
88
+ )
89
+ print(f"Video upload successful: {response_video}")
90
+ except UploadPostError as e:
91
+ print(f"Video upload failed: {e}")
92
+
93
+ # Example: Upload photos
94
+ try:
95
+ response_photos = client.upload_photos(
96
+ photos=["/path/to/image1.jpg", Path("/path/to/image2.png"), "https://example.com/photo3.jpg"],
97
+ user="testuser",
98
+ platforms=["instagram", "facebook"],
99
+ title="My Photo Album",
100
+ caption="Check out these cool photos!",
101
+ # Platform-specific parameters
102
+ facebook_page_id="your_facebook_page_id", # Required for Facebook
103
+ media_type="IMAGE" # For Instagram, "IMAGE" or "STORIES"
104
+ )
105
+ print(f"Photo upload successful: {response_photos}")
106
+ except UploadPostError as e:
107
+ print(f"Photo upload failed: {e}")
108
+
109
+ # Example: Upload a text post
110
+ try:
111
+ response_text = client.upload_text(
112
+ user="testuser",
113
+ platforms=["x", "linkedin"],
114
+ title="This is my awesome text post! #Python #API",
115
+ # Platform-specific parameters
116
+ # For LinkedIn, if posting to an organization page:
117
+ # target_linkedin_page_id="your_linkedin_page_id",
118
+ # For Facebook, facebook_page_id is required:
119
+ # facebook_page_id="your_facebook_page_id"
120
+ # (add 'facebook' to platforms list too)
121
+ )
122
+ print(f"Text post successful: {response_text}")
123
+ except UploadPostError as e:
124
+ print(f"Text post failed: {e}")
125
+ ```
126
+
127
+ ## Error Handling
128
+
129
+ The client raises `UploadPostError` exceptions for API errors. Common error scenarios:
130
+
131
+ - Invalid API key
132
+ - Missing required parameters
133
+ - File not found
134
+ - Platform not supported
135
+ - API rate limits exceeded
136
+
137
+ ## Documentation
138
+
139
+ For full API documentation and platform availability, see the official [Upload-Post.com documentation](https://www.upload-post.com/).
140
+
141
+ ## License
142
+
143
+ MIT License - See [LICENSE](LICENSE) for details.
@@ -0,0 +1,119 @@
1
+ # upload-post Python Client
2
+
3
+ A Python client for the [Upload-Post.com](https://www.upload-post.com/) API, designed to facilitate interaction with the service. Upload-Post.com allows you to upload videos to multiple social media platforms simultaneously.
4
+
5
+ [![PyPI version](https://img.shields.io/pypi/v/upload-post.svg)](https://pypi.org/project/upload-post/)
6
+ [![Python Versions](https://img.shields.io/pypi/pyversions/upload-post.svg)](https://pypi.org/project/upload-post/)
7
+
8
+ ## Features
9
+
10
+ - 🚀 Upload videos to TikTok, Instagram, LinkedIn, YouTube, Facebook, X (Twitter), Threads, and Pinterest (platform support based on API availability)
11
+ - 🖼️ Upload photos to TikTok, Instagram, LinkedIn, Facebook, X (Twitter), Threads, and Pinterest
12
+ - ✍️ Upload text posts to LinkedIn, X (Twitter), Facebook, and Threads
13
+ - 🔒 Secure API key authentication
14
+ - 📁 File validation and error handling
15
+ - 📊 Detailed logging
16
+ - 🤖 Both CLI and Python API interfaces
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ pip install upload-post
22
+ ```
23
+
24
+ ## Usage
25
+
26
+ ### Command Line Interface
27
+
28
+ ```bash
29
+ upload-post \
30
+ --api-key "your_api_key_here" \
31
+ --video "/path/to/video.mp4" \
32
+ --title "My Awesome Video" \
33
+ --user "testuser" \
34
+ --platforms tiktok instagram
35
+ ```
36
+
37
+ ### Python API
38
+
39
+ ```python
40
+ from upload_post import UploadPostClient, UploadPostError
41
+ from pathlib import Path
42
+
43
+ # Initialize client
44
+ client = UploadPostClient(api_key="your_api_key_here")
45
+
46
+ # Example: Upload a video
47
+ try:
48
+ response_video = client.upload_video(
49
+ video_path="/path/to/video.mp4", # Can also be a URL: "https://example.com/video.mp4"
50
+ title="My Awesome Video",
51
+ user="testuser",
52
+ platforms=["tiktok", "youtube", "linkedin"],
53
+ # TikTok specific
54
+ privacy_level="PUBLIC_TO_EVERYONE",
55
+ disable_comment=False,
56
+ # YouTube specific
57
+ description="Detailed description for YouTube",
58
+ tags=["tutorial", "python", "api"],
59
+ categoryId="22", # "People & Blogs"
60
+ privacyStatus="public",
61
+ # LinkedIn specific
62
+ visibility="PUBLIC", # Required for LinkedIn if not using default
63
+ description="Post commentary for LinkedIn" # Optional, uses title if not set
64
+ )
65
+ print(f"Video upload successful: {response_video}")
66
+ except UploadPostError as e:
67
+ print(f"Video upload failed: {e}")
68
+
69
+ # Example: Upload photos
70
+ try:
71
+ response_photos = client.upload_photos(
72
+ photos=["/path/to/image1.jpg", Path("/path/to/image2.png"), "https://example.com/photo3.jpg"],
73
+ user="testuser",
74
+ platforms=["instagram", "facebook"],
75
+ title="My Photo Album",
76
+ caption="Check out these cool photos!",
77
+ # Platform-specific parameters
78
+ facebook_page_id="your_facebook_page_id", # Required for Facebook
79
+ media_type="IMAGE" # For Instagram, "IMAGE" or "STORIES"
80
+ )
81
+ print(f"Photo upload successful: {response_photos}")
82
+ except UploadPostError as e:
83
+ print(f"Photo upload failed: {e}")
84
+
85
+ # Example: Upload a text post
86
+ try:
87
+ response_text = client.upload_text(
88
+ user="testuser",
89
+ platforms=["x", "linkedin"],
90
+ title="This is my awesome text post! #Python #API",
91
+ # Platform-specific parameters
92
+ # For LinkedIn, if posting to an organization page:
93
+ # target_linkedin_page_id="your_linkedin_page_id",
94
+ # For Facebook, facebook_page_id is required:
95
+ # facebook_page_id="your_facebook_page_id"
96
+ # (add 'facebook' to platforms list too)
97
+ )
98
+ print(f"Text post successful: {response_text}")
99
+ except UploadPostError as e:
100
+ print(f"Text post failed: {e}")
101
+ ```
102
+
103
+ ## Error Handling
104
+
105
+ The client raises `UploadPostError` exceptions for API errors. Common error scenarios:
106
+
107
+ - Invalid API key
108
+ - Missing required parameters
109
+ - File not found
110
+ - Platform not supported
111
+ - API rate limits exceeded
112
+
113
+ ## Documentation
114
+
115
+ For full API documentation and platform availability, see the official [Upload-Post.com documentation](https://www.upload-post.com/).
116
+
117
+ ## License
118
+
119
+ MIT License - See [LICENSE](LICENSE) for details.
@@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
5
5
 
6
6
  setup(
7
7
  name="upload-post",
8
- version="0.1.0",
8
+ version="0.1.2",
9
9
  author="Manuel Gracia",
10
10
  author_email="hi@img2html.com",
11
11
  description="Python client for Upload-Post.com API",
@@ -1,4 +1,4 @@
1
- __version__ = "0.1.0"
1
+ __version__ = "0.1.2"
2
2
  from .api_client import UploadPostClient, UploadPostError
3
3
 
4
4
  __all__ = ['UploadPostClient', 'UploadPostError']
@@ -0,0 +1,268 @@
1
+ from pathlib import Path
2
+ from typing import Dict, List, Union, Optional
3
+
4
+ import requests
5
+
6
+
7
+ class UploadPostError(Exception):
8
+ """Base exception for Upload-Post API errors"""
9
+ pass
10
+
11
+ class UploadPostClient:
12
+ BASE_URL = "https://api.upload-post.com/api"
13
+
14
+ def __init__(self, api_key: str):
15
+ self.api_key = api_key
16
+ self.session = requests.Session()
17
+ self.session.headers.update({
18
+ "Authorization": f"Apikey {self.api_key}",
19
+ "User-Agent": f"upload-post-python-client/0.1.0"
20
+ })
21
+
22
+ def upload_video(
23
+ self,
24
+ video_path: Union[str, Path],
25
+ title: str,
26
+ user: str,
27
+ platforms: List[str],
28
+ **kwargs
29
+ ) -> Dict:
30
+ """
31
+ Upload a video to specified social media platforms.
32
+
33
+ Args:
34
+ video_path: Path to video file (str or Path) or video URL (str).
35
+ title: Video title.
36
+ user: User identifier.
37
+ platforms: List of platforms (e.g., ["tiktok", "instagram", "linkedin"]).
38
+ **kwargs: Platform-specific parameters.
39
+ tiktok: privacy_level (str), disable_duet (bool), disable_comment (bool),
40
+ disable_stitch (bool), cover_timestamp (int), brand_content_toggle (bool),
41
+ brand_organic (bool), branded_content (bool), brand_organic_toggle (bool),
42
+ is_aigc (bool)
43
+ instagram: media_type (str), share_to_feed (bool), collaborators (str),
44
+ cover_url (str), audio_name (str), user_tags (str),
45
+ location_id (str), thumb_offset (str)
46
+ linkedin: description (str), visibility (str), target_linkedin_page_id (str)
47
+ youtube: description (str), tags (List[str]), categoryId (str),
48
+ privacyStatus (str), embeddable (bool), license (str),
49
+ publicStatsViewable (bool), madeForKids (bool)
50
+ facebook: facebook_page_id (str), description (str), video_state (str)
51
+ threads: description (str)
52
+ x: tagged_user_ids (List[str]), reply_settings (str), nullcast (bool),
53
+ place_id (str), poll_duration (int), poll_options (List[str]),
54
+ poll_reply_settings (str)
55
+ pinterest: pinterest_board_id (str), pinterest_link (str),
56
+ pinterest_cover_image_url (str),
57
+ pinterest_cover_image_content_type (str),
58
+ pinterest_cover_image_data (str),
59
+ pinterest_cover_image_key_frame_time (int)
60
+
61
+ Returns:
62
+ API response JSON.
63
+
64
+ Raises:
65
+ UploadPostError: If upload fails or video file not found.
66
+ """
67
+ data_payload: List[tuple] = []
68
+ files_payload: List[tuple] = []
69
+ video_file_obj = None # To keep track of the opened file
70
+
71
+ try:
72
+ # Prepare video
73
+ if isinstance(video_path, str) and \
74
+ (video_path.startswith('http://') or video_path.startswith('https://')):
75
+ # It's a URL
76
+ data_payload.append(('video', video_path))
77
+ else:
78
+ # It's a file path
79
+ video_p = Path(video_path)
80
+ if not video_p.exists():
81
+ raise UploadPostError(f"Video file not found: {video_p}")
82
+
83
+ video_file_obj = video_p.open("rb")
84
+ files_payload.append(('video', (video_p.name, video_file_obj)))
85
+
86
+ # Prepare common parameters
87
+ data_payload.append(('title', title))
88
+ data_payload.append(('user', user))
89
+ for p in platforms:
90
+ data_payload.append(('platform[]', p))
91
+
92
+ # Add platform-specific parameters from kwargs
93
+ for key, value in kwargs.items():
94
+ if isinstance(value, bool):
95
+ data_payload.append((key, str(value).lower())) # 'true' or 'false'
96
+ elif isinstance(value, list):
97
+ for v_item in value: # Handles array parameters like 'tags' or 'tagged_user_ids'
98
+ data_payload.append((f'{key}[]' if key.endswith('s') else key, str(v_item))) # API expects tags[] for YouTube, etc.
99
+ else:
100
+ data_payload.append((key, str(value)))
101
+
102
+ response = self.session.post(
103
+ f"{self.BASE_URL}/upload", # Endpoint for video is /upload
104
+ files=files_payload if files_payload else None,
105
+ data=data_payload
106
+ )
107
+ response.raise_for_status()
108
+ return response.json()
109
+
110
+ except requests.exceptions.RequestException as e:
111
+ raise UploadPostError(
112
+ f"API request failed: {str(e)}"
113
+ ) from e
114
+ except (ValueError, TypeError) as e:
115
+ raise UploadPostError(
116
+ f"Invalid response format: {str(e)}"
117
+ ) from e
118
+ finally:
119
+ if video_file_obj:
120
+ video_file_obj.close()
121
+
122
+ def upload_photos(
123
+ self,
124
+ photos: List[Union[str, Path]],
125
+ user: str,
126
+ platforms: List[str],
127
+ title: str,
128
+ caption: Optional[str] = None,
129
+ **kwargs
130
+ ) -> Dict:
131
+ """
132
+ Upload photos to specified social media platforms.
133
+
134
+ Args:
135
+ photos: List of photo file paths (str or Path) or photo URLs (str).
136
+ user: User identifier.
137
+ platforms: List of platforms (e.g., ["tiktok", "instagram"]).
138
+ title: Title of the post.
139
+ caption: Optional caption/description for the photos.
140
+ **kwargs: Platform-specific parameters.
141
+ linkedin: visibility (str), target_linkedin_page_id (str)
142
+ facebook: facebook_page_id (str)
143
+ tiktok: auto_add_music (bool), disable_comment (bool),
144
+ branded_content (bool), disclose_commercial (bool),
145
+ photo_cover_index (int), description (str)
146
+ instagram: media_type (str)
147
+ pinterest: pinterest_board_id (str), pinterest_alt_text (str),
148
+ pinterest_link (str)
149
+
150
+ Returns:
151
+ API response JSON.
152
+
153
+ Raises:
154
+ UploadPostError: If upload fails or any photo file not found.
155
+ """
156
+ data_payload: List[tuple] = []
157
+ files_payload: List[tuple] = []
158
+ opened_files: List[object] = [] # To keep track of files to close them later
159
+
160
+ try:
161
+ # Prepare photos
162
+ for photo_item in photos:
163
+ if isinstance(photo_item, str) and \
164
+ (photo_item.startswith('http://') or photo_item.startswith('https://')):
165
+ # It's a URL
166
+ data_payload.append(('photos[]', photo_item))
167
+ else:
168
+ # It's a file path
169
+ photo_path = Path(photo_item)
170
+ if not photo_path.exists():
171
+ raise UploadPostError(f"Photo file not found: {photo_path}")
172
+
173
+ photo_file_obj = photo_path.open("rb")
174
+ opened_files.append(photo_file_obj)
175
+ files_payload.append(('photos[]', (photo_path.name, photo_file_obj)))
176
+
177
+ # Prepare common parameters
178
+ data_payload.append(('user', user))
179
+ data_payload.append(('title', title))
180
+ if caption is not None:
181
+ data_payload.append(('caption', caption))
182
+
183
+ for p in platforms:
184
+ data_payload.append(('platform[]', p))
185
+
186
+ # Add platform-specific parameters from kwargs
187
+ for key, value in kwargs.items():
188
+ if isinstance(value, bool):
189
+ data_payload.append((key, str(value).lower())) # 'true' or 'false'
190
+ elif isinstance(value, list):
191
+ for v_item in value: # Handles cases where a kwarg value is a list
192
+ data_payload.append((key, str(v_item)))
193
+ else:
194
+ data_payload.append((key, str(value)))
195
+
196
+ response = self.session.post(
197
+ f"{self.BASE_URL}/upload_photos",
198
+ files=files_payload if files_payload else None,
199
+ data=data_payload
200
+ )
201
+ response.raise_for_status()
202
+ return response.json()
203
+
204
+ except requests.exceptions.RequestException as e:
205
+ raise UploadPostError(f"API request failed: {str(e)}") from e
206
+ except (ValueError, TypeError) as e: # ValueError for json parsing, TypeError for bad args
207
+ raise UploadPostError(f"Data or response format error: {str(e)}") from e
208
+ finally:
209
+ for f_obj in opened_files:
210
+ f_obj.close()
211
+
212
+ def upload_text(
213
+ self,
214
+ user: str,
215
+ platforms: List[str],
216
+ title: str, # As per API docs, 'title' is used for the text content
217
+ **kwargs
218
+ ) -> Dict:
219
+ """
220
+ Upload text posts to specified social media platforms.
221
+
222
+ Args:
223
+ user: User identifier.
224
+ platforms: List of platforms (e.g., ["x", "linkedin"]).
225
+ Supported: "linkedin", "x", "facebook", "threads".
226
+ title: The text content for the post.
227
+ **kwargs: Platform-specific parameters.
228
+ linkedin: target_linkedin_page_id (str)
229
+ facebook: facebook_page_id (str)
230
+
231
+ Returns:
232
+ API response JSON.
233
+
234
+ Raises:
235
+ UploadPostError: If upload fails.
236
+ """
237
+ data_payload: List[tuple] = []
238
+
239
+ try:
240
+ # Prepare common parameters
241
+ data_payload.append(('user', user))
242
+ data_payload.append(('title', title)) # 'title' carries the text content
243
+
244
+ for p in platforms:
245
+ data_payload.append(('platform[]', p))
246
+
247
+ # Add platform-specific parameters from kwargs
248
+ # (e.g., target_linkedin_page_id, facebook_page_id)
249
+ for key, value in kwargs.items():
250
+ if isinstance(value, bool): # Should not happen based on current docs for text
251
+ data_payload.append((key, str(value).lower()))
252
+ elif isinstance(value, list): # Should not happen based on current docs for text
253
+ for v_item in value:
254
+ data_payload.append((key, str(v_item)))
255
+ else:
256
+ data_payload.append((key, str(value)))
257
+
258
+ response = self.session.post(
259
+ f"{self.BASE_URL}/upload_text",
260
+ data=data_payload
261
+ )
262
+ response.raise_for_status()
263
+ return response.json()
264
+
265
+ except requests.exceptions.RequestException as e:
266
+ raise UploadPostError(f"API request failed: {str(e)}") from e
267
+ except (ValueError, TypeError) as e:
268
+ raise UploadPostError(f"Data or response format error: {str(e)}") from e
@@ -18,8 +18,8 @@ def main():
18
18
  "--platforms",
19
19
  nargs="+",
20
20
  required=True,
21
- choices=["tiktok", "instagram", "facebook", "youtube"],
22
- help="Platforms to upload to"
21
+ choices=["tiktok", "instagram", "linkedin", "youtube", "facebook", "x", "threads", "pinterest"],
22
+ help="Platforms to upload to. For platform-specific parameters, please use the Python API."
23
23
  )
24
24
  parser.add_argument(
25
25
  "--verbose",
@@ -0,0 +1,143 @@
1
+ Metadata-Version: 2.4
2
+ Name: upload-post
3
+ Version: 0.1.2
4
+ Summary: Python client for Upload-Post.com API
5
+ Home-page: https://www.upload-post.com/
6
+ Author: Manuel Gracia
7
+ Author-email: hi@img2html.com
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.8
12
+ Description-Content-Type: text/markdown
13
+ Requires-Dist: requests>=2.25.1
14
+ Requires-Dist: python-dotenv>=0.19.0
15
+ Dynamic: author
16
+ Dynamic: author-email
17
+ Dynamic: classifier
18
+ Dynamic: description
19
+ Dynamic: description-content-type
20
+ Dynamic: home-page
21
+ Dynamic: requires-dist
22
+ Dynamic: requires-python
23
+ Dynamic: summary
24
+
25
+ # upload-post Python Client
26
+
27
+ A Python client for the [Upload-Post.com](https://www.upload-post.com/) API, designed to facilitate interaction with the service. Upload-Post.com allows you to upload videos to multiple social media platforms simultaneously.
28
+
29
+ [![PyPI version](https://img.shields.io/pypi/v/upload-post.svg)](https://pypi.org/project/upload-post/)
30
+ [![Python Versions](https://img.shields.io/pypi/pyversions/upload-post.svg)](https://pypi.org/project/upload-post/)
31
+
32
+ ## Features
33
+
34
+ - 🚀 Upload videos to TikTok, Instagram, LinkedIn, YouTube, Facebook, X (Twitter), Threads, and Pinterest (platform support based on API availability)
35
+ - 🖼️ Upload photos to TikTok, Instagram, LinkedIn, Facebook, X (Twitter), Threads, and Pinterest
36
+ - ✍️ Upload text posts to LinkedIn, X (Twitter), Facebook, and Threads
37
+ - 🔒 Secure API key authentication
38
+ - 📁 File validation and error handling
39
+ - 📊 Detailed logging
40
+ - 🤖 Both CLI and Python API interfaces
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ pip install upload-post
46
+ ```
47
+
48
+ ## Usage
49
+
50
+ ### Command Line Interface
51
+
52
+ ```bash
53
+ upload-post \
54
+ --api-key "your_api_key_here" \
55
+ --video "/path/to/video.mp4" \
56
+ --title "My Awesome Video" \
57
+ --user "testuser" \
58
+ --platforms tiktok instagram
59
+ ```
60
+
61
+ ### Python API
62
+
63
+ ```python
64
+ from upload_post import UploadPostClient, UploadPostError
65
+ from pathlib import Path
66
+
67
+ # Initialize client
68
+ client = UploadPostClient(api_key="your_api_key_here")
69
+
70
+ # Example: Upload a video
71
+ try:
72
+ response_video = client.upload_video(
73
+ video_path="/path/to/video.mp4", # Can also be a URL: "https://example.com/video.mp4"
74
+ title="My Awesome Video",
75
+ user="testuser",
76
+ platforms=["tiktok", "youtube", "linkedin"],
77
+ # TikTok specific
78
+ privacy_level="PUBLIC_TO_EVERYONE",
79
+ disable_comment=False,
80
+ # YouTube specific
81
+ description="Detailed description for YouTube",
82
+ tags=["tutorial", "python", "api"],
83
+ categoryId="22", # "People & Blogs"
84
+ privacyStatus="public",
85
+ # LinkedIn specific
86
+ visibility="PUBLIC", # Required for LinkedIn if not using default
87
+ description="Post commentary for LinkedIn" # Optional, uses title if not set
88
+ )
89
+ print(f"Video upload successful: {response_video}")
90
+ except UploadPostError as e:
91
+ print(f"Video upload failed: {e}")
92
+
93
+ # Example: Upload photos
94
+ try:
95
+ response_photos = client.upload_photos(
96
+ photos=["/path/to/image1.jpg", Path("/path/to/image2.png"), "https://example.com/photo3.jpg"],
97
+ user="testuser",
98
+ platforms=["instagram", "facebook"],
99
+ title="My Photo Album",
100
+ caption="Check out these cool photos!",
101
+ # Platform-specific parameters
102
+ facebook_page_id="your_facebook_page_id", # Required for Facebook
103
+ media_type="IMAGE" # For Instagram, "IMAGE" or "STORIES"
104
+ )
105
+ print(f"Photo upload successful: {response_photos}")
106
+ except UploadPostError as e:
107
+ print(f"Photo upload failed: {e}")
108
+
109
+ # Example: Upload a text post
110
+ try:
111
+ response_text = client.upload_text(
112
+ user="testuser",
113
+ platforms=["x", "linkedin"],
114
+ title="This is my awesome text post! #Python #API",
115
+ # Platform-specific parameters
116
+ # For LinkedIn, if posting to an organization page:
117
+ # target_linkedin_page_id="your_linkedin_page_id",
118
+ # For Facebook, facebook_page_id is required:
119
+ # facebook_page_id="your_facebook_page_id"
120
+ # (add 'facebook' to platforms list too)
121
+ )
122
+ print(f"Text post successful: {response_text}")
123
+ except UploadPostError as e:
124
+ print(f"Text post failed: {e}")
125
+ ```
126
+
127
+ ## Error Handling
128
+
129
+ The client raises `UploadPostError` exceptions for API errors. Common error scenarios:
130
+
131
+ - Invalid API key
132
+ - Missing required parameters
133
+ - File not found
134
+ - Platform not supported
135
+ - API rate limits exceeded
136
+
137
+ ## Documentation
138
+
139
+ For full API documentation and platform availability, see the official [Upload-Post.com documentation](https://www.upload-post.com/).
140
+
141
+ ## License
142
+
143
+ MIT License - See [LICENSE](LICENSE) for details.
@@ -1,94 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: upload-post
3
- Version: 0.1.0
4
- Summary: Python client for Upload-Post.com API
5
- Home-page: https://www.upload-post.com/
6
- Author: Manuel Gracia
7
- Author-email: hi@img2html.com
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.8
12
- Description-Content-Type: text/markdown
13
- Requires-Dist: requests>=2.25.1
14
- Requires-Dist: python-dotenv>=0.19.0
15
- Dynamic: author
16
- Dynamic: author-email
17
- Dynamic: classifier
18
- Dynamic: description
19
- Dynamic: description-content-type
20
- Dynamic: home-page
21
- Dynamic: requires-dist
22
- Dynamic: requires-python
23
- Dynamic: summary
24
-
25
- # upload-post Python Client
26
-
27
- A Python client for Upload-Post.com API - upload videos to multiple social media platforms simultaneously.
28
-
29
- [![PyPI version](https://img.shields.io/pypi/v/upload-post.svg)](https://pypi.org/project/upload-post/)
30
- [![Python Versions](https://img.shields.io/pypi/pyversions/upload-post.svg)](https://pypi.org/project/upload-post/)
31
-
32
- ## Features
33
-
34
- - 🚀 Upload videos to TikTok, Instagram, Facebook, and YouTube (platform support based on API availability)
35
- - 🔒 Secure API key authentication
36
- - 📁 File validation and error handling
37
- - 📊 Detailed logging
38
- - 🤖 Both CLI and Python API interfaces
39
-
40
- ## Installation
41
-
42
- ```bash
43
- pip install upload-post
44
- ```
45
-
46
- ## Usage
47
-
48
- ### Command Line Interface
49
-
50
- ```bash
51
- upload-post \
52
- --api-key "your_api_key_here" \
53
- --video "/path/to/video.mp4" \
54
- --title "My Awesome Video" \
55
- --user "testuser" \
56
- --platforms tiktok instagram
57
- ```
58
-
59
- ### Python API
60
-
61
- ```python
62
- from upload_post import UploadPostClient
63
-
64
- client = UploadPostClient(api_key="your_api_key_here")
65
-
66
- response = client.upload_video(
67
- video_path="/path/to/video.mp4",
68
- title="My Awesome Video",
69
- user="testuser",
70
- platforms=["tiktok", "instagram"]
71
- )
72
- ```
73
-
74
- ## Error Handling
75
-
76
- The client raises `UploadPostError` exceptions for API errors. Common error scenarios:
77
-
78
- - Invalid API key
79
- - Missing required parameters
80
- - File not found
81
- - Platform not supported
82
- - API rate limits exceeded
83
-
84
- ## Documentation
85
-
86
- For full API documentation and platform availability, see the official [Upload-Post.com documentation](https://www.upload-post.com/).
87
-
88
- ## Contributing
89
-
90
- Contributions are welcome! Please open an issue or PR on our [GitHub repository](https://github.com/yourusername/upload-post-client).
91
-
92
- ## License
93
-
94
- MIT License - See [LICENSE](LICENSE) for details.
@@ -1,70 +0,0 @@
1
- # upload-post Python Client
2
-
3
- A Python client for Upload-Post.com API - upload videos to multiple social media platforms simultaneously.
4
-
5
- [![PyPI version](https://img.shields.io/pypi/v/upload-post.svg)](https://pypi.org/project/upload-post/)
6
- [![Python Versions](https://img.shields.io/pypi/pyversions/upload-post.svg)](https://pypi.org/project/upload-post/)
7
-
8
- ## Features
9
-
10
- - 🚀 Upload videos to TikTok, Instagram, Facebook, and YouTube (platform support based on API availability)
11
- - 🔒 Secure API key authentication
12
- - 📁 File validation and error handling
13
- - 📊 Detailed logging
14
- - 🤖 Both CLI and Python API interfaces
15
-
16
- ## Installation
17
-
18
- ```bash
19
- pip install upload-post
20
- ```
21
-
22
- ## Usage
23
-
24
- ### Command Line Interface
25
-
26
- ```bash
27
- upload-post \
28
- --api-key "your_api_key_here" \
29
- --video "/path/to/video.mp4" \
30
- --title "My Awesome Video" \
31
- --user "testuser" \
32
- --platforms tiktok instagram
33
- ```
34
-
35
- ### Python API
36
-
37
- ```python
38
- from upload_post import UploadPostClient
39
-
40
- client = UploadPostClient(api_key="your_api_key_here")
41
-
42
- response = client.upload_video(
43
- video_path="/path/to/video.mp4",
44
- title="My Awesome Video",
45
- user="testuser",
46
- platforms=["tiktok", "instagram"]
47
- )
48
- ```
49
-
50
- ## Error Handling
51
-
52
- The client raises `UploadPostError` exceptions for API errors. Common error scenarios:
53
-
54
- - Invalid API key
55
- - Missing required parameters
56
- - File not found
57
- - Platform not supported
58
- - API rate limits exceeded
59
-
60
- ## Documentation
61
-
62
- For full API documentation and platform availability, see the official [Upload-Post.com documentation](https://www.upload-post.com/).
63
-
64
- ## Contributing
65
-
66
- Contributions are welcome! Please open an issue or PR on our [GitHub repository](https://github.com/yourusername/upload-post-client).
67
-
68
- ## License
69
-
70
- MIT License - See [LICENSE](LICENSE) for details.
@@ -1,70 +0,0 @@
1
- import requests
2
- from pathlib import Path
3
- from typing import Dict, List, Union
4
-
5
- class UploadPostError(Exception):
6
- """Base exception for Upload-Post API errors"""
7
- pass
8
-
9
- class UploadPostClient:
10
- BASE_URL = "https://api.upload-post.com/api"
11
-
12
- def __init__(self, api_key: str):
13
- self.api_key = api_key
14
- self.session = requests.Session()
15
- self.session.headers.update({
16
- "Authorization": f"Apikey {self.api_key}",
17
- "User-Agent": f"upload-post-python-client/0.1.0"
18
- })
19
-
20
- def upload_video(
21
- self,
22
- video_path: Union[str, Path],
23
- title: str,
24
- user: str,
25
- platforms: List[str]
26
- ) -> Dict:
27
- """
28
- Upload a video to specified social media platforms
29
-
30
- Args:
31
- video_path: Path to video file
32
- title: Video title
33
- user: User identifier
34
- platforms: List of platforms (e.g. ["tiktok", "instagram"])
35
-
36
- Returns:
37
- API response JSON
38
-
39
- Raises:
40
- UploadPostError: If upload fails
41
- """
42
- video_path = Path(video_path)
43
- if not video_path.exists():
44
- raise UploadPostError(f"Video file not found: {video_path}")
45
-
46
- try:
47
- with video_path.open("rb") as video_file:
48
- files = {"video": video_file}
49
- data = {
50
- "title": title,
51
- "user": user,
52
- "platform[]": platforms
53
- }
54
-
55
- response = self.session.post(
56
- f"{self.BASE_URL}/upload",
57
- files=files,
58
- data=data
59
- )
60
- response.raise_for_status()
61
- return response.json()
62
-
63
- except requests.exceptions.RequestException as e:
64
- raise UploadPostError(
65
- f"API request failed: {str(e)}"
66
- ) from e
67
- except (ValueError, TypeError) as e:
68
- raise UploadPostError(
69
- f"Invalid response format: {str(e)}"
70
- ) from e
@@ -1,94 +0,0 @@
1
- Metadata-Version: 2.2
2
- Name: upload-post
3
- Version: 0.1.0
4
- Summary: Python client for Upload-Post.com API
5
- Home-page: https://www.upload-post.com/
6
- Author: Manuel Gracia
7
- Author-email: hi@img2html.com
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Operating System :: OS Independent
11
- Requires-Python: >=3.8
12
- Description-Content-Type: text/markdown
13
- Requires-Dist: requests>=2.25.1
14
- Requires-Dist: python-dotenv>=0.19.0
15
- Dynamic: author
16
- Dynamic: author-email
17
- Dynamic: classifier
18
- Dynamic: description
19
- Dynamic: description-content-type
20
- Dynamic: home-page
21
- Dynamic: requires-dist
22
- Dynamic: requires-python
23
- Dynamic: summary
24
-
25
- # upload-post Python Client
26
-
27
- A Python client for Upload-Post.com API - upload videos to multiple social media platforms simultaneously.
28
-
29
- [![PyPI version](https://img.shields.io/pypi/v/upload-post.svg)](https://pypi.org/project/upload-post/)
30
- [![Python Versions](https://img.shields.io/pypi/pyversions/upload-post.svg)](https://pypi.org/project/upload-post/)
31
-
32
- ## Features
33
-
34
- - 🚀 Upload videos to TikTok, Instagram, Facebook, and YouTube (platform support based on API availability)
35
- - 🔒 Secure API key authentication
36
- - 📁 File validation and error handling
37
- - 📊 Detailed logging
38
- - 🤖 Both CLI and Python API interfaces
39
-
40
- ## Installation
41
-
42
- ```bash
43
- pip install upload-post
44
- ```
45
-
46
- ## Usage
47
-
48
- ### Command Line Interface
49
-
50
- ```bash
51
- upload-post \
52
- --api-key "your_api_key_here" \
53
- --video "/path/to/video.mp4" \
54
- --title "My Awesome Video" \
55
- --user "testuser" \
56
- --platforms tiktok instagram
57
- ```
58
-
59
- ### Python API
60
-
61
- ```python
62
- from upload_post import UploadPostClient
63
-
64
- client = UploadPostClient(api_key="your_api_key_here")
65
-
66
- response = client.upload_video(
67
- video_path="/path/to/video.mp4",
68
- title="My Awesome Video",
69
- user="testuser",
70
- platforms=["tiktok", "instagram"]
71
- )
72
- ```
73
-
74
- ## Error Handling
75
-
76
- The client raises `UploadPostError` exceptions for API errors. Common error scenarios:
77
-
78
- - Invalid API key
79
- - Missing required parameters
80
- - File not found
81
- - Platform not supported
82
- - API rate limits exceeded
83
-
84
- ## Documentation
85
-
86
- For full API documentation and platform availability, see the official [Upload-Post.com documentation](https://www.upload-post.com/).
87
-
88
- ## Contributing
89
-
90
- Contributions are welcome! Please open an issue or PR on our [GitHub repository](https://github.com/yourusername/upload-post-client).
91
-
92
- ## License
93
-
94
- MIT License - See [LICENSE](LICENSE) for details.
File without changes