A
NameError: name 'name' is not defined
__name__
Size: a a a
A
__name__
K
K
K
K
A
K
A
A
K
A
K
K
K
import flask as Flask
import telebot
app = Flask(__name__)
app.config['SECRET_KEY'] = config.SECRET_KEY
app.config['UPLOAD_FOLDER'] = config.UPLOAD_FOLDER
WEBHOOK_HOST = '0.0.0.0'
WEBHOOK_PORT = 443
WEBHOOK_LISTEN = '0.0.0.0'
WEBHOOK_SSL_CERT = 'webhook_cert.pem'
WEBHOOK_SSL_PRIV = 'webhook_pkey.pem'
WEBHOOK_URL_BASE = f'https://{WEBHOOK_HOST}:{WEBHOOK_PORT}'
WEBHOOK_URL_PATH = f'/bot{config.token}/'
bot = telebot.TeleBot(config.token, parse_mode='HTML')
@bot.message_handler(commands=['start'])
def start(message):
bot.send_message(message.chat.id, "hi")
@app.route(WEBHOOK_URL_PATH, methods=['POST'])
def webhook():
if flask.request.headers.get('content-type') == 'application/json':
json_string = json.loads(request.get_data().decode('utf-8'))
update = telebot.types.Update.de_json(json_string)
bot.process_new_updates([update])
return ''
else:
flask.abort(403)
A
A
A