InitConnectionRequest
Both users and bots can use this request. See code examples.
---functions--- initConnection#c1cd5ea9 {X:Type} flags:# api_id:int device_model:string system_version:string app_version:string system_lang_code:string lang_pack:string lang_code:string proxy:flags.0?InputClientProxy params:flags.1?JSONValue query:!X = X
Returns
This request returns the result of whatever the result from invoking the request passed through query is.
Parameters
api_id | int | |
device_model | string | |
system_version | string | |
app_version | string | |
system_lang_code | string | |
lang_pack | string | |
lang_code | string | |
query | !X | A different Request must be supplied for this argument. |
proxy | InputClientProxy | This argument defaults to None and can be omitted. |
params | JSONValue | This argument defaults to None and can be omitted. |
Known RPC errors
This request can cause 2 known errors:
ConnectionLayerInvalidError | The very first request must always be InvokeWithLayerRequest. |
InputFetchFailError | Failed deserializing TL payload. |
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.InitConnectionRequest( api_id=42, device_model='ASUS Laptop', system_version='Arch Linux', app_version='1.0', system_lang_code='en', lang_pack='', lang_code='en', query=other_request, proxy=types.InputClientProxy( address='some string here', port=42 ), params=types.JsonNull() )) print(result.stringify())