fixes
This commit is contained in:
31
bsky_post.py
31
bsky_post.py
@@ -144,10 +144,6 @@ def is_transient_error(error_obj) -> bool:
|
||||
def get_rate_limit_wait_seconds(error_obj, default_delay: float, max_delay: float) -> float:
|
||||
"""
|
||||
Parse common rate-limit headers and return a bounded wait time in seconds.
|
||||
Supports:
|
||||
- retry-after
|
||||
- x-ratelimit-after
|
||||
- ratelimit-reset (unix timestamp)
|
||||
"""
|
||||
try:
|
||||
now_ts = int(time.time())
|
||||
@@ -323,33 +319,6 @@ def upload_image(
|
||||
return None
|
||||
|
||||
|
||||
def upload_video(
|
||||
client: Client,
|
||||
video_path: str,
|
||||
alt_text: str = "",
|
||||
) -> models.AppBskyEmbedVideo.Main | None:
|
||||
try:
|
||||
mime = detect_mime_type(video_path)
|
||||
with open(video_path, "rb") as f:
|
||||
data = f.read()
|
||||
|
||||
logging.info(f"🎬 Uploading video: {video_path} ({len(data)/1024:.1f} KB, {mime})")
|
||||
response = client.upload_blob(data)
|
||||
logging.info("✅ Video blob uploaded successfully.")
|
||||
|
||||
return models.AppBskyEmbedVideo.Main(
|
||||
video=response.blob,
|
||||
alt=alt_text,
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
logging.error(f"❌ Failed to upload video: {repr(e)}")
|
||||
return None
|
||||
|
||||
|
||||
# ============================================================
|
||||
# Post
|
||||
# ============================================================
|
||||
# ============================================================
|
||||
# Post
|
||||
# ============================================================
|
||||
|
||||
Reference in New Issue
Block a user