pyTelegramBotAPI icon indicating copy to clipboard operation
pyTelegramBotAPI copied to clipboard

A request to the Telegram API was unsuccessful.

Open captCovalent opened this issue 6 years ago • 0 comments

Please answer these questions before submitting your issue. Thanks!

  1. What version of pyTelegramBotAPI are you using? 3.7.1

  2. What OS are you using? MacOS 10.15.4

  3. What version of python are you using? Python 3.8.3

This is where my code fails:

def check_address(wallet, symbol):
    try:
        response = requests.get("https://shapeshift.io/validateAddress/" + wallet + "/" + symbol)
        data = response.json()
        if data['isvalid'] == True:
            return True
        else:
            return False
    except Exception as e:
        print(str(e))
if check_address(message.text, database[user_id]['Get'].split('(', 1)[1].split(')')[0]) == True:
                    bot.send_message(user_id,'✅ ' + str(database[user_id]['Get']) + ' address nominal.')
                    database[user_id]['Wallet'] = message.text
                    keyboard = ReplyKeyboardMarkup(True, one_time_keyboard=True)
                    keyboard.row('Confirm', '⬅️ Back')
                    bot.send_message(user_id, '🤖 ' + order_confirmation(user_id, 'swap') + '\n\n'\
                        + 'Please make sure all the information you’ve entered is correct. Then tap the Confirm button below.', reply_markup=keyboard, parse_mode='Markdown')            
                
                else:
                    keyboard = ReplyKeyboardMarkup(True, one_time_keyboard=True)
                    keyboard.row('⬅️ Back')
                    bot.send_message(user_id,'⚠️ ERRNO_1rwai: Recipient wallet address is invalid.\nEnter the recipient *' + symbol_get + '* wallet address.', parse_mode='Markdown', reply_markup=keyboard)

I get A request to the Telegram API was unsuccessful. The server returned HTTP 400 Bad Request. Response body: [b'{"ok":false,"error_code":400,"description":"Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 12"}'] when check_address(wallet, symbol) returns False.

captCovalent avatar May 18 '20 19:05 captCovalent