用python(Pywhatkit)发送whatsapp消息有时会失败

2024-06-25 23:26:13 发布

您现在位置:Python中文网/ 问答频道 /正文

背景:我正在尝试发送RSVP(婚礼到excel中客人列表中的号码)

方法: im使用pywhatkit发送带有RSVP页面链接的消息,代码如下:

import pywhatkit
import openpyxl

# extracting numbers from excel
wb = openpyxl.load_workbook('wedding.xlsx')
ws = wb["Sheet1"]
num = []
for row in ws.iter_rows(min_row=1, max_col=1, values_only=True):
   for value in row:
     num.append('+' + str(value))

# message content
text1 = "please confirm RSVP in https://*****/?phone="
text2 = " \n _please do not reply to this number_"

# sending the links
for x in num:
    pywhatkit.sendwhatmsg_instantly( x , text1 + x + text2, 10, True, 10)

对于示例,让我们使用:

for x in range(10):
    pywhatkit.sendwhatmsg_instantly( '+****' , 'test' + str(x), 10, True, 10)

我试图将延迟更改为[12,3]、[5,5]、[5,10]和更多

结果:发送消息有时会失败。因此,如果我们看一看示例,我会收到8/10的消息。在这些时候,它似乎失败了,它会将消息写入文本框,但不按发送。
请记住,我需要将此邮件发送给400人,因此我不能设置长时间延迟

有解决方法吗?
是否有办法检查邮件是否已发送,以便重试?
还有其他更稳定的图书馆吗


Tags: 方法inimporttrue消息forwsvalue