S
S
Sergey Kopytoff2020-09-22 07:25:19
Python
Sergey Kopytoff, 2020-09-22 07:25:19

Communication of two telebot pythons?

Greetings! I have a question related to telegram bot; namely
- - there are 2 *.py files -
one telo.py file performs the function of a get request to my server, parses json data and outputs them to the console.
-the second file botv1.py is a bot with a replay keyboard, which, by pressing the GetZN button, should send the user a list of orders that the telo.py file actually receives.
body.py

import server
import requests
import json
def zapros():
    zapros = requests.get( server.FullZap, auth=(server.login, server.password) )
    jsonDATA = json.loads( zapros.text )
    num = 0
    print(jsonDATA['value'][num]['Number'])
if __name__ == '__main__':
    zapros()


botv1.py
import telebot
import server
#import keyboard
from telo import zapros
from telebot import types
bot = telebot.TeleBot(server.token)
txtmsg = zapros()
@bot.message_handler(func=lambda message: True, content_types=['text'])


def start(message):
    if message.text == '/start':
        bot.send_message(message.chat.id, zapros())
        markupZN = types.ReplyKeyboardMarkup()
        markupZN.row('GET ZN')
        bot.send_message(message.chat.id, "Вот список заказ нарядов: ", reply_markup=markupZN)

if __name__ == '__main__':
    bot.polling(none_stop=True)

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question