简体   繁体   English

Python 和 Telethon:如何处理 sw 分发

[英]Python and Telethon: how to handle sw distribution

I developed a program to interact between Telegram and other 3rd party Software.我开发了一个程序来在 Telegram 和其他 3rd 方软件之间进行交互。 It's written in Python and I used the Telethon library.它是用 Python 编写的,我使用了 Telethon 库。

Everything works fine, but since it uses my personal configuration including API ID, API hash, phone number and username, I would like to know how to handle all of this if I wanted to distribute the software to other people.一切正常,但由于它使用我的个人配置,包括 API ID、API 哈希、电话号码和用户名,如果我想将软件分发给其他人,我想知道如何处理所有这些。

Of course they can't use my data, so should they login into Telegram development page and get all the info?他们当然不能使用我的数据,所以他们应该登录 Telegram 开发页面并获取所有信息吗? Or, is there a more user-friendly way to do it?或者,有没有更用户友好的方式来做到这一点?

Since the API ID and the API Hash in Telegram are supposed to be distributed with your client all you need to do is prompt the user for their Phone Number.由于 Telegram 中的 API ID 和 API 哈希应该与您的客户端一起分发,因此您需要做的就是提示用户输入他们的电话号码。

You could do this using a GUI Library (like PySide2 using QInputDialog ) or if it is a command line application using input() .您可以使用 GUI 库(如 PySide2 使用QInputDialog )或如果它是使用input()的命令行应用程序来执行此操作。 Keep in mind that the user will also need a way to enter the code they receive from Telegram and their 2FA Password if set.请记住,用户还需要一种方法来输入他们从 Telegram 收到的代码和他们的 2FA 密码(如果设置)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM