我正在尝试在循环中执行下面的函数def post_webhook(payload):
if not WEBHOOK_URL:
print "WEBHOOK_URL isn't setted"
return
try:
json = {'data': payload}
print "webhook_url:", WEBHOOK_URL
r = requests.post(WEBHOOK_URL, data=json)
print "requests.post:", r.text
except Exception as e:
print "post_webhook err:", e
像这样
^{pr2}$
但是,post_webhook函数只执行一次
当我在while循环中调用post_webbook()时,print "requests.post:", r.text不会在post\u webhook()中执行
结果,r = requests.post(WEBHOOK_URL, data=json)只在循环中执行一次,我想在循环中多次执行post_webhook()
为什么是请求.post只执行了一次循环?在