marqetive-lib 0.2.3__py3-none-any.whl → 0.2.5__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/platforms/twitter/client.py +8 -3
- marqetive/platforms/twitter/media.py +22 -0
- {marqetive_lib-0.2.3.dist-info → marqetive_lib-0.2.5.dist-info}/METADATA +1 -1
- {marqetive_lib-0.2.3.dist-info → marqetive_lib-0.2.5.dist-info}/RECORD +5 -5
- {marqetive_lib-0.2.3.dist-info → marqetive_lib-0.2.5.dist-info}/WHEEL +0 -0
|
@@ -621,6 +621,9 @@ class TwitterClient(SocialMediaPlatform):
|
|
|
621
621
|
url=HttpUrl(media_url),
|
|
622
622
|
)
|
|
623
623
|
|
|
624
|
+
except PlatformAuthError:
|
|
625
|
+
# Re-raise auth errors (including TwitterUnauthorizedError) directly
|
|
626
|
+
raise
|
|
624
627
|
except Exception as e:
|
|
625
628
|
raise MediaUploadError(
|
|
626
629
|
f"Failed to upload media: {e}",
|
|
@@ -914,9 +917,11 @@ class TwitterClient(SocialMediaPlatform):
|
|
|
914
917
|
return MediaAttachment(
|
|
915
918
|
media_id=result.media_id,
|
|
916
919
|
media_type=MediaType.IMAGE, # Simplified type
|
|
917
|
-
url=
|
|
918
|
-
|
|
919
|
-
|
|
920
|
+
url=(
|
|
921
|
+
HttpUrl(media_url)
|
|
922
|
+
if media_url.startswith("http")
|
|
923
|
+
else HttpUrl(f"file://{media_url}")
|
|
924
|
+
),
|
|
920
925
|
)
|
|
921
926
|
|
|
922
927
|
except Exception as e:
|
|
@@ -25,6 +25,7 @@ from marqetive.core.exceptions import (
|
|
|
25
25
|
MediaUploadError,
|
|
26
26
|
)
|
|
27
27
|
from marqetive.core.models import ProgressEvent, ProgressStatus
|
|
28
|
+
from marqetive.platforms.twitter.exceptions import TwitterUnauthorizedError
|
|
28
29
|
from marqetive.utils.file_handlers import download_file
|
|
29
30
|
from marqetive.utils.media import (
|
|
30
31
|
detect_mime_type,
|
|
@@ -399,6 +400,17 @@ class TwitterMediaManager:
|
|
|
399
400
|
|
|
400
401
|
try:
|
|
401
402
|
return await _do_upload()
|
|
403
|
+
except httpx.HTTPStatusError as e:
|
|
404
|
+
if e.response.status_code == 401:
|
|
405
|
+
raise TwitterUnauthorizedError(
|
|
406
|
+
"Unauthorized: Invalid or expired access token",
|
|
407
|
+
error_code=89,
|
|
408
|
+
) from e
|
|
409
|
+
raise MediaUploadError(
|
|
410
|
+
f"Simple upload failed: {e}",
|
|
411
|
+
platform="twitter",
|
|
412
|
+
media_type=detect_mime_type(file_path),
|
|
413
|
+
) from e
|
|
402
414
|
except httpx.HTTPError as e:
|
|
403
415
|
raise MediaUploadError(
|
|
404
416
|
f"Simple upload failed: {e}",
|
|
@@ -701,6 +713,16 @@ class TwitterMediaManager:
|
|
|
701
713
|
response.raise_for_status()
|
|
702
714
|
logger.info(f"Added alt text to media: {media_id}")
|
|
703
715
|
|
|
716
|
+
except httpx.HTTPStatusError as e:
|
|
717
|
+
if e.response.status_code == 401:
|
|
718
|
+
raise TwitterUnauthorizedError(
|
|
719
|
+
"Unauthorized: Invalid or expired access token",
|
|
720
|
+
error_code=89,
|
|
721
|
+
) from e
|
|
722
|
+
raise MediaUploadError(
|
|
723
|
+
f"Failed to add alt text: {e}",
|
|
724
|
+
platform="twitter",
|
|
725
|
+
) from e
|
|
704
726
|
except httpx.HTTPError as e:
|
|
705
727
|
raise MediaUploadError(
|
|
706
728
|
f"Failed to add alt text: {e}",
|
|
@@ -22,9 +22,9 @@ marqetive/platforms/tiktok/exceptions.py,sha256=vxwyAKujMGZJh0LetG1QsLF95QfUs_kR
|
|
|
22
22
|
marqetive/platforms/tiktok/media.py,sha256=NmvzvzfaZMmzIx88wkXI5tWLd4vYN1VJXN-IkaEAO2c,28638
|
|
23
23
|
marqetive/platforms/tiktok/models.py,sha256=WWdjuFqhTIR8SnHkz-8UaNc5Mm2PrGomwQ3W7pJcQFg,2962
|
|
24
24
|
marqetive/platforms/twitter/__init__.py,sha256=etiNzWd0EznrDbFTlc71dc_Cm-aqAM7RIwpj8qrYEiE,447
|
|
25
|
-
marqetive/platforms/twitter/client.py,sha256=
|
|
25
|
+
marqetive/platforms/twitter/client.py,sha256=FehFLOh6n1YZyFe_4jrztSlw9iZK21eJzb9fHj0Jxu8,44551
|
|
26
26
|
marqetive/platforms/twitter/exceptions.py,sha256=AvXzucqF2P6F3-lynayt461oj9e1luCh2-El5pXqZL4,9832
|
|
27
|
-
marqetive/platforms/twitter/media.py,sha256=
|
|
27
|
+
marqetive/platforms/twitter/media.py,sha256=cWELUTDFlyS7WIjEzkCaXOMOiSZZ3eAwpmiX90-CDjM,28954
|
|
28
28
|
marqetive/platforms/twitter/models.py,sha256=afFK1jJyrIC6BvY6ShkHlg-KnvawdeLGS-hB-GoloWA,4579
|
|
29
29
|
marqetive/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
30
30
|
marqetive/utils/__init__.py,sha256=bSrNajbxYBSKQayrPviLz8JeGjplnyK8y_NGDtgb7yQ,977
|
|
@@ -33,6 +33,6 @@ marqetive/utils/helpers.py,sha256=Sh5HZD6AOJig_6T84n6JsKLosIkKIkpkiYTl69rnOOw,13
|
|
|
33
33
|
marqetive/utils/media.py,sha256=reVousdueG-h5jeI6uLGqVCfjYxlsMiWhx6XZwg-iHY,14664
|
|
34
34
|
marqetive/utils/oauth.py,sha256=3TtbUCVuGxtOBxIUvVJH_DUMIHrP76XDpabPYaLXhTU,15392
|
|
35
35
|
marqetive/utils/retry.py,sha256=UcgrmVBVG5zd30_11mZnRnTaSFrbUYXBO1DrXPR0f8E,7627
|
|
36
|
-
marqetive_lib-0.2.
|
|
37
|
-
marqetive_lib-0.2.
|
|
38
|
-
marqetive_lib-0.2.
|
|
36
|
+
marqetive_lib-0.2.5.dist-info/METADATA,sha256=BRheSgC6_t0edQbE03iP0OlaCalnzV2XamoTHNdxnGo,7875
|
|
37
|
+
marqetive_lib-0.2.5.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
|
38
|
+
marqetive_lib-0.2.5.dist-info/RECORD,,
|
|
File without changes
|