marqetive-lib 0.1.1__py3-none-any.whl → 0.1.3__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.
- marqetive/__init__.py +13 -13
- marqetive/core/__init__.py +1 -1
- marqetive/core/account_factory.py +2 -2
- marqetive/core/base_manager.py +4 -4
- marqetive/core/client.py +1 -1
- marqetive/core/registry.py +3 -3
- marqetive/platforms/__init__.py +6 -6
- marqetive/platforms/base.py +3 -3
- marqetive/platforms/exceptions.py +2 -1
- marqetive/platforms/instagram/__init__.py +3 -3
- marqetive/platforms/instagram/client.py +4 -4
- marqetive/platforms/instagram/exceptions.py +1 -1
- marqetive/platforms/instagram/factory.py +5 -5
- marqetive/platforms/instagram/manager.py +4 -4
- marqetive/platforms/instagram/media.py +2 -2
- marqetive/platforms/linkedin/__init__.py +3 -3
- marqetive/platforms/linkedin/client.py +4 -4
- marqetive/platforms/linkedin/exceptions.py +1 -1
- marqetive/platforms/linkedin/factory.py +5 -5
- marqetive/platforms/linkedin/manager.py +4 -4
- marqetive/platforms/linkedin/media.py +4 -4
- marqetive/platforms/models.py +2 -0
- marqetive/platforms/tiktok/__init__.py +7 -0
- marqetive/platforms/tiktok/client.py +492 -0
- marqetive/platforms/tiktok/exceptions.py +284 -0
- marqetive/platforms/tiktok/factory.py +188 -0
- marqetive/platforms/tiktok/manager.py +115 -0
- marqetive/platforms/tiktok/media.py +693 -0
- marqetive/platforms/twitter/__init__.py +3 -3
- marqetive/platforms/twitter/client.py +8 -54
- marqetive/platforms/twitter/exceptions.py +1 -1
- marqetive/platforms/twitter/factory.py +5 -6
- marqetive/platforms/twitter/manager.py +4 -4
- marqetive/platforms/twitter/media.py +4 -4
- marqetive/registry_init.py +10 -8
- marqetive/utils/__init__.py +3 -3
- marqetive/utils/file_handlers.py +1 -1
- marqetive/utils/oauth.py +137 -2
- marqetive/utils/token_validator.py +1 -1
- {marqetive_lib-0.1.1.dist-info → marqetive_lib-0.1.3.dist-info}/METADATA +1 -2
- marqetive_lib-0.1.3.dist-info/RECORD +47 -0
- marqetive/platforms/twitter/threads.py +0 -442
- marqetive_lib-0.1.1.dist-info/RECORD +0 -43
- {marqetive_lib-0.1.1.dist-info → marqetive_lib-0.1.3.dist-info}/WHEEL +0 -0
marqetive/__init__.py
CHANGED
|
@@ -5,13 +5,13 @@ HTTP requests, data processing, and social media platform integrations.
|
|
|
5
5
|
|
|
6
6
|
Usage:
|
|
7
7
|
Basic API client:
|
|
8
|
-
>>> from
|
|
8
|
+
>>> from marqetive import APIClient
|
|
9
9
|
>>> async with APIClient(base_url="https://api.example.com") as client:
|
|
10
10
|
... response = await client.get("/endpoint")
|
|
11
11
|
|
|
12
12
|
Platform managers (high-level):
|
|
13
|
-
>>> from
|
|
14
|
-
>>> from
|
|
13
|
+
>>> from marqetive import initialize_platform_registry, get_manager_for_platform
|
|
14
|
+
>>> from marqetive.platforms.models import AuthCredentials, PostCreateRequest
|
|
15
15
|
>>>
|
|
16
16
|
>>> initialize_platform_registry()
|
|
17
17
|
>>> manager = get_manager_for_platform("twitter")
|
|
@@ -20,7 +20,7 @@ Usage:
|
|
|
20
20
|
>>> post = await manager.execute_post(credentials, request)
|
|
21
21
|
|
|
22
22
|
Platform clients (low-level):
|
|
23
|
-
>>> from
|
|
23
|
+
>>> from marqetive.platforms.twitter import TwitterClient
|
|
24
24
|
>>> credentials = AuthCredentials(platform="twitter", access_token="...")
|
|
25
25
|
>>> async with TwitterClient(credentials) as client:
|
|
26
26
|
... post = await client.create_post(request)
|
|
@@ -28,20 +28,20 @@ Usage:
|
|
|
28
28
|
|
|
29
29
|
# Core API client
|
|
30
30
|
# Account management
|
|
31
|
-
from
|
|
31
|
+
from marqetive.core.account_factory import BaseAccountFactory
|
|
32
32
|
|
|
33
33
|
# Registry and managers
|
|
34
|
-
from
|
|
35
|
-
from
|
|
34
|
+
from marqetive.core.base_manager import BasePostManager
|
|
35
|
+
from marqetive.core.client import APIClient
|
|
36
36
|
|
|
37
37
|
# Progress tracking
|
|
38
|
-
from
|
|
38
|
+
from marqetive.core.progress import (
|
|
39
39
|
ProgressCallback,
|
|
40
40
|
ProgressEvent,
|
|
41
41
|
ProgressStatus,
|
|
42
42
|
ProgressTracker,
|
|
43
43
|
)
|
|
44
|
-
from
|
|
44
|
+
from marqetive.core.registry import (
|
|
45
45
|
PlatformRegistry,
|
|
46
46
|
get_available_platforms,
|
|
47
47
|
get_manager_for_platform,
|
|
@@ -50,7 +50,7 @@ from src.marqetive.core.registry import (
|
|
|
50
50
|
)
|
|
51
51
|
|
|
52
52
|
# Models
|
|
53
|
-
from
|
|
53
|
+
from marqetive.platforms.models import (
|
|
54
54
|
AccountStatus,
|
|
55
55
|
AuthCredentials,
|
|
56
56
|
Comment,
|
|
@@ -62,16 +62,16 @@ from src.marqetive.platforms.models import (
|
|
|
62
62
|
PostStatus,
|
|
63
63
|
PostUpdateRequest,
|
|
64
64
|
)
|
|
65
|
-
from
|
|
65
|
+
from marqetive.registry_init import (
|
|
66
66
|
initialize_platform_registry,
|
|
67
67
|
is_registry_initialized,
|
|
68
68
|
)
|
|
69
69
|
|
|
70
70
|
# Utilities
|
|
71
|
-
from
|
|
71
|
+
from marqetive.utils.helpers import format_response
|
|
72
72
|
|
|
73
73
|
# Retry utilities
|
|
74
|
-
from
|
|
74
|
+
from marqetive.utils.retry import STANDARD_BACKOFF, BackoffConfig, retry_async
|
|
75
75
|
|
|
76
76
|
__version__ = "0.1.0"
|
|
77
77
|
|
marqetive/core/__init__.py
CHANGED
|
@@ -9,8 +9,8 @@ from abc import ABC, abstractmethod
|
|
|
9
9
|
from collections.abc import Callable
|
|
10
10
|
from typing import Any
|
|
11
11
|
|
|
12
|
-
from
|
|
13
|
-
from
|
|
12
|
+
from marqetive.platforms.exceptions import PlatformAuthError
|
|
13
|
+
from marqetive.platforms.models import AccountStatus, AuthCredentials
|
|
14
14
|
|
|
15
15
|
logger = logging.getLogger(__name__)
|
|
16
16
|
|
marqetive/core/base_manager.py
CHANGED
|
@@ -10,10 +10,10 @@ import logging
|
|
|
10
10
|
from abc import ABC, abstractmethod
|
|
11
11
|
from typing import Any
|
|
12
12
|
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
16
|
-
from
|
|
13
|
+
from marqetive.core.account_factory import BaseAccountFactory
|
|
14
|
+
from marqetive.core.progress import ProgressCallback, ProgressTracker
|
|
15
|
+
from marqetive.platforms.exceptions import PlatformError
|
|
16
|
+
from marqetive.platforms.models import AuthCredentials, Post, PostCreateRequest
|
|
17
17
|
|
|
18
18
|
logger = logging.getLogger(__name__)
|
|
19
19
|
|
marqetive/core/client.py
CHANGED
|
@@ -73,7 +73,7 @@ class APIClient:
|
|
|
73
73
|
if not self._client:
|
|
74
74
|
raise RuntimeError("Client not initialized. Use async context manager.")
|
|
75
75
|
|
|
76
|
-
response
|
|
76
|
+
response = await self._client.get(path, params=params)
|
|
77
77
|
response.raise_for_status()
|
|
78
78
|
|
|
79
79
|
return APIResponse(
|
marqetive/core/registry.py
CHANGED
|
@@ -7,7 +7,7 @@ platform managers across the application.
|
|
|
7
7
|
import threading
|
|
8
8
|
from typing import Any, TypeVar
|
|
9
9
|
|
|
10
|
-
from
|
|
10
|
+
from marqetive.platforms.models import AuthCredentials
|
|
11
11
|
|
|
12
12
|
# Type variable for manager classes
|
|
13
13
|
ManagerType = TypeVar("ManagerType")
|
|
@@ -22,7 +22,7 @@ class PlatformRegistry:
|
|
|
22
22
|
Thread-safe implementation using threading.Lock.
|
|
23
23
|
|
|
24
24
|
Example:
|
|
25
|
-
>>> from
|
|
25
|
+
>>> from marqetive.platforms.twitter.manager import TwitterPostManager
|
|
26
26
|
>>> registry = PlatformRegistry()
|
|
27
27
|
>>> registry.register_platform("twitter", TwitterPostManager)
|
|
28
28
|
>>> manager = registry.get_manager("twitter", credentials=creds)
|
|
@@ -213,7 +213,7 @@ def register_platform(platform_name: str, manager_class: type) -> None:
|
|
|
213
213
|
manager_class: The manager class to register.
|
|
214
214
|
|
|
215
215
|
Example:
|
|
216
|
-
>>> from
|
|
216
|
+
>>> from marqetive.platforms.twitter.manager import TwitterPostManager
|
|
217
217
|
>>> register_platform("twitter", TwitterPostManager)
|
|
218
218
|
"""
|
|
219
219
|
registry = get_registry()
|
marqetive/platforms/__init__.py
CHANGED
|
@@ -4,13 +4,13 @@ This package provides a unified interface for interacting with various social
|
|
|
4
4
|
media platforms including Instagram, Twitter/X, and LinkedIn.
|
|
5
5
|
|
|
6
6
|
Platform clients are available via their respective subpackages:
|
|
7
|
-
- from
|
|
8
|
-
- from
|
|
9
|
-
- from
|
|
7
|
+
- from marqetive.platforms.twitter import TwitterClient
|
|
8
|
+
- from marqetive.platforms.linkedin import LinkedInClient
|
|
9
|
+
- from marqetive.platforms.instagram import InstagramClient
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
|
-
from
|
|
13
|
-
from
|
|
12
|
+
from marqetive.platforms.base import SocialMediaPlatform
|
|
13
|
+
from marqetive.platforms.exceptions import (
|
|
14
14
|
MediaUploadError,
|
|
15
15
|
PlatformAuthError,
|
|
16
16
|
PlatformError,
|
|
@@ -18,7 +18,7 @@ from src.marqetive.platforms.exceptions import (
|
|
|
18
18
|
RateLimitError,
|
|
19
19
|
ValidationError,
|
|
20
20
|
)
|
|
21
|
-
from
|
|
21
|
+
from marqetive.platforms.models import (
|
|
22
22
|
AuthCredentials,
|
|
23
23
|
Comment,
|
|
24
24
|
CommentStatus,
|
marqetive/platforms/base.py
CHANGED
|
@@ -10,12 +10,12 @@ from datetime import datetime
|
|
|
10
10
|
from traceback import TracebackException
|
|
11
11
|
from typing import Any
|
|
12
12
|
|
|
13
|
-
from
|
|
14
|
-
from
|
|
13
|
+
from marqetive.core.client import APIClient
|
|
14
|
+
from marqetive.platforms.exceptions import (
|
|
15
15
|
PlatformAuthError,
|
|
16
16
|
RateLimitError,
|
|
17
17
|
)
|
|
18
|
-
from
|
|
18
|
+
from marqetive.platforms.models import (
|
|
19
19
|
AuthCredentials,
|
|
20
20
|
Comment,
|
|
21
21
|
MediaAttachment,
|
|
@@ -115,9 +115,10 @@ class PostNotFoundError(PlatformError):
|
|
|
115
115
|
post_id: str,
|
|
116
116
|
platform: str | None = None,
|
|
117
117
|
status_code: int | None = None,
|
|
118
|
+
message: str | None = None,
|
|
118
119
|
) -> None:
|
|
119
120
|
self.post_id = post_id
|
|
120
|
-
message = f"Post not found: {post_id}"
|
|
121
|
+
message = message or f"Post not found: {post_id}"
|
|
121
122
|
super().__init__(message, platform, status_code)
|
|
122
123
|
|
|
123
124
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""Instagram platform integration."""
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
from
|
|
3
|
+
from marqetive.platforms.instagram.client import InstagramClient
|
|
4
|
+
from marqetive.platforms.instagram.factory import InstagramAccountFactory
|
|
5
|
+
from marqetive.platforms.instagram.manager import InstagramPostManager
|
|
6
6
|
|
|
7
7
|
__all__ = ["InstagramClient", "InstagramAccountFactory", "InstagramPostManager"]
|
|
@@ -12,19 +12,19 @@ from typing import Any, Literal, cast
|
|
|
12
12
|
import httpx
|
|
13
13
|
from pydantic import HttpUrl
|
|
14
14
|
|
|
15
|
-
from
|
|
16
|
-
from
|
|
15
|
+
from marqetive.platforms.base import SocialMediaPlatform
|
|
16
|
+
from marqetive.platforms.exceptions import (
|
|
17
17
|
MediaUploadError,
|
|
18
18
|
PlatformAuthError,
|
|
19
19
|
PlatformError,
|
|
20
20
|
PostNotFoundError,
|
|
21
21
|
ValidationError,
|
|
22
22
|
)
|
|
23
|
-
from
|
|
23
|
+
from marqetive.platforms.instagram.media import (
|
|
24
24
|
InstagramMediaManager,
|
|
25
25
|
MediaItem,
|
|
26
26
|
)
|
|
27
|
-
from
|
|
27
|
+
from marqetive.platforms.models import (
|
|
28
28
|
AuthCredentials,
|
|
29
29
|
Comment,
|
|
30
30
|
CommentStatus,
|
|
@@ -5,7 +5,7 @@ This module provides comprehensive error handling for Instagram Graph API errors
|
|
|
5
5
|
|
|
6
6
|
from typing import Any
|
|
7
7
|
|
|
8
|
-
from
|
|
8
|
+
from marqetive.platforms.exceptions import (
|
|
9
9
|
MediaUploadError,
|
|
10
10
|
PlatformAuthError,
|
|
11
11
|
PlatformError,
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
import logging
|
|
4
4
|
from collections.abc import Callable
|
|
5
5
|
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
10
|
-
from
|
|
6
|
+
from marqetive.core.account_factory import BaseAccountFactory
|
|
7
|
+
from marqetive.platforms.exceptions import PlatformAuthError
|
|
8
|
+
from marqetive.platforms.instagram.client import InstagramClient
|
|
9
|
+
from marqetive.platforms.models import AccountStatus, AuthCredentials
|
|
10
|
+
from marqetive.utils.oauth import refresh_instagram_token
|
|
11
11
|
|
|
12
12
|
logger = logging.getLogger(__name__)
|
|
13
13
|
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import logging
|
|
4
4
|
from typing import Any
|
|
5
5
|
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
6
|
+
from marqetive.core.base_manager import BasePostManager
|
|
7
|
+
from marqetive.platforms.instagram.client import InstagramClient
|
|
8
|
+
from marqetive.platforms.instagram.factory import InstagramAccountFactory
|
|
9
|
+
from marqetive.platforms.models import AuthCredentials, Post, PostCreateRequest
|
|
10
10
|
|
|
11
11
|
logger = logging.getLogger(__name__)
|
|
12
12
|
|
|
@@ -19,11 +19,11 @@ from typing import Any, Literal
|
|
|
19
19
|
|
|
20
20
|
import httpx
|
|
21
21
|
|
|
22
|
-
from
|
|
22
|
+
from marqetive.platforms.exceptions import (
|
|
23
23
|
MediaUploadError,
|
|
24
24
|
ValidationError,
|
|
25
25
|
)
|
|
26
|
-
from
|
|
26
|
+
from marqetive.utils.retry import STANDARD_BACKOFF, retry_async
|
|
27
27
|
|
|
28
28
|
logger = logging.getLogger(__name__)
|
|
29
29
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"""LinkedIn platform integration."""
|
|
2
2
|
|
|
3
|
-
from
|
|
4
|
-
from
|
|
5
|
-
from
|
|
3
|
+
from marqetive.platforms.linkedin.client import LinkedInClient
|
|
4
|
+
from marqetive.platforms.linkedin.factory import LinkedInAccountFactory
|
|
5
|
+
from marqetive.platforms.linkedin.manager import LinkedInPostManager
|
|
6
6
|
|
|
7
7
|
__all__ = ["LinkedInClient", "LinkedInAccountFactory", "LinkedInPostManager"]
|
|
@@ -12,16 +12,16 @@ from typing import Any, cast
|
|
|
12
12
|
import httpx
|
|
13
13
|
from pydantic import HttpUrl
|
|
14
14
|
|
|
15
|
-
from
|
|
16
|
-
from
|
|
15
|
+
from marqetive.platforms.base import SocialMediaPlatform
|
|
16
|
+
from marqetive.platforms.exceptions import (
|
|
17
17
|
MediaUploadError,
|
|
18
18
|
PlatformAuthError,
|
|
19
19
|
PlatformError,
|
|
20
20
|
PostNotFoundError,
|
|
21
21
|
ValidationError,
|
|
22
22
|
)
|
|
23
|
-
from
|
|
24
|
-
from
|
|
23
|
+
from marqetive.platforms.linkedin.media import LinkedInMediaManager, MediaAsset
|
|
24
|
+
from marqetive.platforms.models import (
|
|
25
25
|
AuthCredentials,
|
|
26
26
|
Comment,
|
|
27
27
|
CommentStatus,
|
|
@@ -9,7 +9,7 @@ This module provides comprehensive error handling for LinkedIn API errors includ
|
|
|
9
9
|
|
|
10
10
|
from typing import Any
|
|
11
11
|
|
|
12
|
-
from
|
|
12
|
+
from marqetive.platforms.exceptions import (
|
|
13
13
|
MediaUploadError,
|
|
14
14
|
PlatformAuthError,
|
|
15
15
|
PlatformError,
|
|
@@ -4,11 +4,11 @@ import logging
|
|
|
4
4
|
import os
|
|
5
5
|
from collections.abc import Callable
|
|
6
6
|
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
10
|
-
from
|
|
11
|
-
from
|
|
7
|
+
from marqetive.core.account_factory import BaseAccountFactory
|
|
8
|
+
from marqetive.platforms.exceptions import PlatformAuthError
|
|
9
|
+
from marqetive.platforms.linkedin.client import LinkedInClient
|
|
10
|
+
from marqetive.platforms.models import AccountStatus, AuthCredentials
|
|
11
|
+
from marqetive.utils.oauth import refresh_linkedin_token
|
|
12
12
|
|
|
13
13
|
logger = logging.getLogger(__name__)
|
|
14
14
|
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import logging
|
|
4
4
|
from typing import Any
|
|
5
5
|
|
|
6
|
-
from
|
|
7
|
-
from
|
|
8
|
-
from
|
|
9
|
-
from
|
|
6
|
+
from marqetive.core.base_manager import BasePostManager
|
|
7
|
+
from marqetive.platforms.linkedin.client import LinkedInClient
|
|
8
|
+
from marqetive.platforms.linkedin.factory import LinkedInAccountFactory
|
|
9
|
+
from marqetive.platforms.models import AuthCredentials, Post, PostCreateRequest
|
|
10
10
|
|
|
11
11
|
logger = logging.getLogger(__name__)
|
|
12
12
|
|
|
@@ -20,13 +20,13 @@ from typing import Any, Literal
|
|
|
20
20
|
|
|
21
21
|
import httpx
|
|
22
22
|
|
|
23
|
-
from
|
|
23
|
+
from marqetive.platforms.exceptions import (
|
|
24
24
|
MediaUploadError,
|
|
25
25
|
ValidationError,
|
|
26
26
|
)
|
|
27
|
-
from
|
|
28
|
-
from
|
|
29
|
-
from
|
|
27
|
+
from marqetive.utils.file_handlers import download_file, read_file_bytes
|
|
28
|
+
from marqetive.utils.media import detect_mime_type, format_file_size
|
|
29
|
+
from marqetive.utils.retry import STANDARD_BACKOFF, retry_async
|
|
30
30
|
|
|
31
31
|
logger = logging.getLogger(__name__)
|
|
32
32
|
|
marqetive/platforms/models.py
CHANGED
|
@@ -305,6 +305,7 @@ class PostCreateRequest(BaseModel):
|
|
|
305
305
|
link: URL to include in the post
|
|
306
306
|
tags: List of hashtags or user tags
|
|
307
307
|
location: Location/place tag for the post
|
|
308
|
+
additional_data: Platform-specific data
|
|
308
309
|
|
|
309
310
|
Example:
|
|
310
311
|
>>> request = PostCreateRequest(
|
|
@@ -321,6 +322,7 @@ class PostCreateRequest(BaseModel):
|
|
|
321
322
|
link: str | None = None
|
|
322
323
|
tags: list[str] = Field(default_factory=list)
|
|
323
324
|
location: str | None = None
|
|
325
|
+
additional_data: dict[str, Any] = Field(default_factory=dict)
|
|
324
326
|
|
|
325
327
|
|
|
326
328
|
class PostUpdateRequest(BaseModel):
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"""TikTok platform integration."""
|
|
2
|
+
|
|
3
|
+
from marqetive.platforms.tiktok.client import TikTokClient
|
|
4
|
+
from marqetive.platforms.tiktok.factory import TikTokAccountFactory
|
|
5
|
+
from marqetive.platforms.tiktok.manager import TikTokPostManager
|
|
6
|
+
|
|
7
|
+
__all__ = ["TikTokClient", "TikTokAccountFactory", "TikTokPostManager"]
|