upload-post 0.1.0__py3-none-any.whl

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,4 @@
1
+ __version__ = "0.1.0"
2
+ from .api_client import UploadPostClient, UploadPostError
3
+
4
+ __all__ = ['UploadPostClient', 'UploadPostError']
@@ -0,0 +1,70 @@
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
upload_post/cli.py ADDED
@@ -0,0 +1,52 @@
1
+ import argparse
2
+ import logging
3
+ from pathlib import Path
4
+ from typing import List
5
+ from . import UploadPostClient, UploadPostError
6
+
7
+ logger = logging.getLogger(__name__)
8
+
9
+ def main():
10
+ parser = argparse.ArgumentParser(
11
+ description="Upload videos to multiple social platforms via Upload-Post.com API"
12
+ )
13
+ parser.add_argument("--api-key", required=True, help="API authentication key")
14
+ parser.add_argument("--video", required=True, type=Path, help="Path to video file")
15
+ parser.add_argument("--title", required=True, help="Video title")
16
+ parser.add_argument("--user", required=True, help="User identifier")
17
+ parser.add_argument(
18
+ "--platforms",
19
+ nargs="+",
20
+ required=True,
21
+ choices=["tiktok", "instagram", "facebook", "youtube"],
22
+ help="Platforms to upload to"
23
+ )
24
+ parser.add_argument(
25
+ "--verbose",
26
+ action="store_true",
27
+ help="Enable verbose logging"
28
+ )
29
+
30
+ args = parser.parse_args()
31
+
32
+ logging.basicConfig(
33
+ level=logging.DEBUG if args.verbose else logging.INFO,
34
+ format="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
35
+ )
36
+
37
+ client = UploadPostClient(api_key=args.api_key)
38
+
39
+ try:
40
+ response = client.upload_video(
41
+ video_path=args.video,
42
+ title=args.title,
43
+ user=args.user,
44
+ platforms=args.platforms
45
+ )
46
+ logger.info(f"Upload successful! Response: {response}")
47
+ except UploadPostError as e:
48
+ logger.error(f"Upload failed: {str(e)}")
49
+ raise SystemExit(1) from e
50
+
51
+ if __name__ == "__main__":
52
+ main()
@@ -0,0 +1,94 @@
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.
@@ -0,0 +1,8 @@
1
+ upload_post/__init__.py,sha256=qV2u_RV8hHd0WBkAyNe611kqJlPqy1bK-75grZg-cLA,131
2
+ upload_post/api_client.py,sha256=1BBOq4us7nc80YqkNl323zXqUUh-CAQAoPQ0shvX7sI,2132
3
+ upload_post/cli.py,sha256=wb037f9A62Y4w4Awa3pLxuqekVbnFDlqzL8Uuu_tOlI,1605
4
+ upload_post-0.1.0.dist-info/METADATA,sha256=OgMWZxEyC3vjxShKj4rQIY-GB5exFvPf0k_uokbiITI,2448
5
+ upload_post-0.1.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
6
+ upload_post-0.1.0.dist-info/entry_points.txt,sha256=D_MqrtgTSJQkRIwPLVCvKcwxNnaoAS8my7_gBtU1X_I,53
7
+ upload_post-0.1.0.dist-info/top_level.txt,sha256=c5Jpx2u159BqOkC2P3Gp3dSotri2_XAADesx3h9pCRU,12
8
+ upload_post-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.8.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ upload-post = upload_post.cli:main
@@ -0,0 +1 @@
1
+ upload_post