Visitar URL original
Giving us the power to handle wrong api_id/api_hash combinations · Issue #421 · pyrogram/pyrogram · GitHub
The Wayback Machine - https://web.archive.org/web/20201210055453/https://github.com/pyrogram/pyrogram/issues/421
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Giving us the power to handle wrong api_id/api_hash combinations #421

Closed
DumbMahreeo opened this issue Jun 14, 2020 · 1 comment
Closed

Giving us the power to handle wrong api_id/api_hash combinations #421

DumbMahreeo opened this issue Jun 14, 2020 · 1 comment

Comments

@DumbMahreeo
Copy link

@DumbMahreeo DumbMahreeo commented Jun 14, 2020

Checklist

  • I believe the idea is awesome and would benefit the library.
  • I have searched in the issue tracker for similar requests, including closed ones.

Description

When we ask the user to manually insert the api_id and the api_hash, they may insert something wrong. The problem is that after that, we can't help the user to understand its mistake or to correct it. The programs gets stuck in an endless loop where it asks for the phone number, and it expect the user to just forcefully close it, when the number is not the problem. I would really like an option in the Client object to manually handle the error, maybe with a try-except. Something like manual_error_handling=True where if some data is wrong it raises an error and we are free to handle it. I couldn't find a solution to this problem, but if it already exist, I apologize for my lack of attention and would like to be redirected to it. Right now I'm still searching for a solution.

@delivrance
Copy link
Member

@delivrance delivrance commented Jul 3, 2020

@DumbMahreeo Hi, for custom login flows you should not be using start/run, instead, you have to manually call each method in the right order as shown in this simple example https://nekobin.com/xakufarufu.py.

Having said that, I tried the following minimal code while using a wrong id/hash combination and I get API_ID_INVALID as expected.

app = Client("testnum", test_mode=True)

app.connect()
app.send_code("xxxxxxxxxx")
@delivrance delivrance closed this Aug 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.