Python Forum
Failure to send verification code - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: Failure to send verification code (/thread-33015.html)



Failure to send verification code - okdude2124 - Mar-22-2021

Hello
I want to perform the steps of login Pyrogram under Felsk
But Verification code will not be sent!
what is the problem?

app.py

from flask import Flask
from flask import render_template,request,redirect,url_for
from pyrogram import Client
app=Flask(__name__)



@app.route('/phone',methods=['GET','POST'])
def phone():
    if request.method=="POST":
        api_id=123
        api_hash="123"
        proxy=dict(hostname="127.0.0.1",port=9150)
        client = Client("bot_session",api_id,api_hash,proxy=proxy)
        client.connect()

        client.send_code(request.form.get("phone"))

        return redirect(url_for('code'))
    else:
        return render_template("phone.html")

@app.route('/code')
def code():
    return "ok"
phone.html

<html>
    <head>
        <title>phone</title>
    </head>
    <body>
        <form method="POST" action="{{ url_for('phone') }}">
            <label>phone</label>
            <input type="text" placeholder="phone" name="phone">
            <button type="submit">ok!</button>
        </form>
    </body>
</html>
[Image: 111884141-e0a65000-89d4-11eb-9758-bd9b6d2039f4.png]