GetDocumentByHashRequest
Both users and bots can use this request. See code examples.
---functions--- messages.getDocumentByHash#b1f2061f sha256:bytes size:long mime_type:string = Document
Returns
| Document |
This type can be an instance of either:
| Document | DocumentEmpty |
Parameters
| sha256 | bytes | |
| size | long | |
| mime_type | string |
Known RPC errors
This request can cause 1 known error:
Sha256HashInvalidError | The provided SHA256 hash is invalid. |
You can import these from telethon.errors.
Example
from telethon.sync import TelegramClient
from telethon import functions, types
with TelegramClient(name, api_id, api_hash) as client:
result = client(functions.messages.GetDocumentByHashRequest(
sha256=b'arbitrary\x7f data \xfa here',
size=-12398745604826,
mime_type='some string here'
))
print(result.stringify())