L
L
l33xx2020-04-29 15:31:44
Python
l33xx, 2020-04-29 15:31:44

How to display 1 message through for and not several?

How to display 1 message through for and not several?

leaktext = messege.text
    url = "https://leakcheck.io/api/"
    key = ""
    type = "auto"
    query = {leaktext}
    data = {'key': key, 'type': type, "check": query}
    req = requests.get(url, data)
    json = req.json()

    if(json['success'] == True):
        for result in json['result']:
            bot.send_message(messege.chat.id,result['line'])

The message looks like this 5ea973550a2a3097531553.png

The json response itself
5ea973a2a0486853058623.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Ivan Yakushenko, 2020-04-29
@l33xx

if json['success']:
    text_message = '\n'.join([result['line'] for result in json['result']])
    bot.send_message(messege.chat.id, result['line'])

T
Timur Pokrovsky, 2020-04-29
@Makaroshka007

I suggest go to google and learn python

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question