Answer the question
In order to leave comments, you need to log in
Why does it give an error when uploading the bot to the server?
If you run it on a computer, then the bot works fine. As soon as you upload the bot to the server and run it there, it gives the following error:
import telebot
import config
import requests
import json
bot = telebot.TeleBot(config.TOKEN)
markdown = """
*bold text*
_italic text_
[text](URL)
"""
namebot = bot.get_me().username
while namebot == 'upcpatickets_bot':
with open('/opt/upcpatickets_bot/id.txt', 'r') as f:
last = f.read()
url = 'https://api-upcpa.affise.com/3.0/admin/ticket/' + str(last) + '?API-Key=' + config.APIKey
answer = requests.get(url)
parsed_string = json.loads(answer.text)
print(parsed_string)
if parsed_string['status'] != 2:
if int(parsed_string['ticket']['id']) >= int(last):
id_web = parsed_string['ticket']['partner']['id']
type_t = parsed_string['ticket']['type']
title_t = parsed_string['ticket']['title']
description_t = parsed_string['ticket']['description']
message_out = '*Получен новый тикет* \n*ID веба:* ' + str(id_web) + '\n' + '*Тип:* ' + str(type_t) + '\n' + \
'*Тема:* ' + title_t + '\n' + '*Описание:* ' + description_t + '\n '
answer = bot.send_message(chat_id='-1001243762925', text=message_out, parse_mode="Markdown")
last2 = int(last)+1
new_data = last.replace(last, str(last2))
with open('/opt/upcpatickets_bot/id.txt', 'w') as f:
f.write(new_data)
else:
continue
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 questionAsk a Question
731 491 924 answers to any question