Skip to main content

tg_file_id

Parse and construct Telegram file_ids and unique_file_ids. Even generate a unique_file_id from a file_id.

Examples below

Install

pip install tg-file-id

Parse file_ids

from tg_file_id.file_id import FileId

file_id = FileId.from_file_id('CAACAgIAAxkBAAIEol9yQhBqFnT4HXldAh31a-hYXuDIAAIECwACAoujAAFFn1sl9AABHbkbBA')

Now the file_id variable is an object like this:

DocumentFileId(
    file_id='CAACAgIAAxkBAAIEol9yQhBqFnT4HXldAh31a-hYXuDIAAIECwACAoujAAFFn1sl9AABHbkbBA',
    type_id=8,
    type_generic='document',
    type_detailed='sticker',
    dc_id=2,
    id=46033261910035204,
    access_hash=-5107925353769492667,
    version=4,
    sub_version=27,
)

Parse file_unique_ids

from tg_file_id.file_unique_id import FileUniqueId

unique_id = FileUniqueId.from_unique_id('AgADBAsAAgKLowAB')

Now the unique_id variable is an object like this:

FileUniqueId(
    unique_id='AgADBAsAAgKLowAB',
    type_id=2,
    id=46033261910035204
)

Convert file_ids to file_unique_ids

from tg_file_id.file_unique_id import FileUniqueId

unique_id = FileUniqueId.from_file_id('CAACAgIAAxkBAAIEol9yQhBqFnT4HXldAh31a-hYXuDIAAIECwACAoujAAFFn1sl9AABHbkbBA')
calculated_file_unique_id = unique_id.to_unique_id()

Now calculated_file_unique_id is

'AgADBAsAAgKLowAB'

Metadata

Release files for tg-file-id 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tg-file-id 0.0.4
File Size Uploaded Provenance Actions
tg_file_id-0.0.4.tar.gz 11.8 kB Without provenance Details for tg_file_id-0.0.4.tar.gz

Release files / tg_file_id-0.0.4.tar.gz

Download URL tg_file_id-0.0.4.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
dc4f89f4acac4a67117c82bd7e40a0be93eaf63870da9dee8ce4cd1860f2e6bb
BLAKE2b-256 checksum
How to use checksums
a1f60133161c967207d78fc3e1e9fb8324afa7e5cea4e7b68c693ae9581779f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Security for tg-file-id 0.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page