miniproto.media
miniproto.media
Section titled “miniproto.media”Public media-transfer APIs for downloading, uploading, CDN decryption, and range caching.
The exports intentionally group high-level download and upload helpers with the typed results, source/destination aliases, and CDN integrity errors they use.
Public objects
Section titled “Public objects”CdnError— Raised when a CDN response cannot be reuploaded, decrypted, or interpreted.CdnIntegrityError— Raised when a CDN range lacks validFileHashcoverage or verification fails.CdnRedirect— Validated information supplied by Telegram when a file moves to its CDN.decrypt_cdn_chunk— Decrypt a CDN ciphertext range with the counter aligned to its file offset.DEFAULT_DOWNLOAD_CONCURRENCY— Public attributeminiproto.media.download.DEFAULT_DOWNLOAD_CONCURRENCY.DEFAULT_DOWNLOAD_IN_FLIGHT_BYTES— Public attributeminiproto.media.download.DEFAULT_DOWNLOAD_IN_FLIGHT_BYTES.DEFAULT_DOWNLOAD_PART_SIZE— Public attributeminiproto.media.download.DEFAULT_DOWNLOAD_PART_SIZE.DEFAULT_RANGE_CACHE_BYTES— Public attributeminiproto.media.download.DEFAULT_RANGE_CACHE_BYTES.Destination— Public type aliasminiproto.media.download.Destination.DownloadRangeCache— Async LRU cache that deduplicates exact media-range requests and bounded prefetches.MAX_DOWNLOAD_CHUNK_SIZE— Public attributeminiproto.media.download.MAX_DOWNLOAD_CHUNK_SIZE.MediaDownloadError— Raised when a requested media range cannot be downloaded or materialized.MediaDownloadResult— Completed materialized-download metadata and optional in-memory payload.MediaIntegrityError— Raised when declared file hashes or download-range invariants are violated.download_file— Download media into memory, a path, or a caller-owned binary stream.download_location_from_media— Resolve a media model, raw Telegram object, file ID, or input location for download.download_media— Resolve media and materialize it through :func:download_file.iter_download— Stream an exact media range as ordered, bounded byte chunks.iter_download_media— Resolve a supported media object and stream it through :func:iter_download.media_from_raw— Normalize supported raw Telegram media shapes into a :class:Mediarecord.BIG_FILE_THRESHOLD— Public attributeminiproto.media.upload.BIG_FILE_THRESHOLD.DEFAULT_CHUNK_SIZE— Public attributeminiproto.media.upload.DEFAULT_CHUNK_SIZE.FileSource— Public type aliasminiproto.media.upload.FileSource.MediaUploadError— Raised only for unsatisfiable part-count configuration orBoolFalsereplies.MediaUploadResult— Completed upload metadata and the MTProto input-file reference to reuse.ProgressCallback— Public type aliasminiproto.media.upload.ProgressCallback.upload_file— Upload a source as MTProto file parts and return its input-file handle.