Skip to content

miniproto.file_id.encode_file_id

encode_file_id(media: Media | object) -> str

Encode supported Telegram media or input locations into a local file ID.

Parameters:

  • media (Media | object) – A Media value, supported generated media object, or input file location.

Returns:

  • str – Canonical URL-safe mpf1_ identifier containing the reusable location fields.

Raises:

  • TypeError – If the media cannot supply a supported reusable location.
  • ValueError – If an extracted field cannot be encoded.