Python 电视节目:如何获得私人频道的邀请链接?

Python 电视节目:如何获得私人频道的邀请链接?,python,telethon,Python,Telethon,在1.5版中,我这样做了: from telethon.tl.functions.channels import ExportInviteRequest from telethon.tl.types import InputChannel, InputPeerChannel ChannelLink = Client(ExportInviteRequest( InputPeerChannel(channel_id=ChannelID, access_hash=Channel

在1.5版中,我这样做了:

from telethon.tl.functions.channels import ExportInviteRequest
from telethon.tl.types import InputChannel, InputPeerChannel
ChannelLink = Client(ExportInviteRequest(
    InputPeerChannel(channel_id=ChannelID,
        access_hash=ChannelHash))).link
但现在它不起作用了:

ImportError: cannot import name 'ExportInviteRequest'

现在如何操作?

原始API可能会在库的次要版本之间发生更改,因此您尝试访问的函数不再存在于以前的位置

无论何时发生这种情况,您都可以找到以下位置:

从telethon.tl.functions.messages导入导出请求
用法仍然相同:

从telethon.sync导入客户端
以电报客户端(名称、api\u id、api\u哈希)作为客户端:
客户端(functions.messages.exportChatRequest)(
渠道
))
您也不需要自己构造
InputPeer
,它是自动完成的