Terrance/SkPy

How to send messages to multiple groups without log in again (raise <Response [400]> error)

Closed this issue · 1 comments

Hi, I am a beginner of SkPy .
I'm trying to send message to multiple groups.
Here's my sample code

    sk = Skype("my_account", "my_pwd")

    cht_name_ls = "['Room A', 'Room B', 'Room C', 'Room D', 'Room E', 'Room F']"
    cht_name_ls = literal_eval(cht_name_ls)

    for each_cht_name in cht_name_ls:
        # search_sk_id is a function to transfer room name to Skype id
        target_id = search_sk_id(sk, each_cht_name)
        print(target_id)

        ch = sk.chats[target_id]

        msg = ch.sendMsg("Test message")

However I met the <Response [400]> error, it seems that I can't change the "ch = sk.chats[target_id]" directly by using loop.
So I change the code like this:

    cht_name_ls = "['Room A', 'Room B', 'Room C', 'Room D', 'Room E', 'Room F']"
    cht_name_ls = literal_eval(cht_name_ls)

    for each_cht_name in cht_name_ls:
        sk = Skype("my_account", "my_pwd")

        # search_sk_id is a function to transfer room name to Skype id
        target_id = search_sk_id(sk, each_cht_name)
        print(target_id)

        ch = sk.chats[target_id]

        msg = ch.sendMsg("Test message")

It seems to fix the problem, but then I met the "log in limit" problem if I want to send msg to more groups.
Is there any alternative way to fix this problem?

Thanks :)

You didn't follow the instructions in the issue template to capture the output of that 400 error, so I don't know what error message you're receiving from Skype.

Chances are that it's flagging you for spam if you're sending messages to multiple chats in quick succession, to which the answer is "don't do that". Repeat authentications will also rate-limit you, and is not a solution.