Asynchronous manager that uploads images concurrently, applying optional compression via libvips or Pillow, and tracks each upload's status with timeout handling.
# Source: https://github.com/mperkins0155/MIRIX | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
import asyncio
import logging
import os
import shutil
import sys
import uuid
logger = logging.getLogger(__name__)
class UploadManager:
"""
Async upload manager that handles each image upload independently.
Each upload gets a timeout and either succeeds or fails.
Uses asyncio for concurrency instead of ThreadPoolExecutor.
"""
def __init__(self, google_client, client, existing_files, uri_to_create_time):
self.google_client = google_client
self.client = client
self.existing_files = existing_files
self.uri_to_create_time = uri_to_cr
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key