写递归函数的问题。不和谐

时间:2018-11-06 23:41:46

标签: python discord

我正在尝试修改此脚本,以便即使同时发送多个消息,该脚本也将继续尝试直到它们被允许通过。

原始脚本为:https://github.com/4rqm/dhooks

我的版本是:

def post(self):
    """
    Send the JSON formated object to the specified `self.url`.
    """ 

    headers = {'Content-Type': 'application/json'}

    result = requests.post(self.url, data=self.json, headers=headers)

    if result.status_code == 400 or result.status_code == 429:
        print(result.status_code)
        #its the line below that does not work.
        post(self)
    else:
        print("Payload delivered successfuly")
        print("Code : "+str(result.status_code))
        time.sleep(2)

0 个答案:

没有答案