我没有将其正确发布到服务器。我已经尝试过了:
payload = {
"ad_id": ad_id,
"ad_type": "1",
"csrf_token": crsf_token,
"messages": [{'content': 'message to server', 'message_type': 'text'}],
"user_id": "9020446"
}
#
headers = {
"Accept": "application/json, text/javascript, */*; q=0.01",
"Accept-Encoding": "gzip, deflate, br",
"Accept-Language": "de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7",
"Content-Type": "application/json",
"Origin": "https://www.wg-gesucht.de",
"Referer": f"https://www.wg-gesucht.de/nachricht-senden.html?message_ad_id={ad_id}"
}
res = browser.post('https://www.wg-gesucht.de/ajax/api/Smp/api.php?action=conversations', payload, headers=headers)
而且我也这样尝试过:
"messages": ['message to server']
但我总是收到401错误。
如果有人可以帮助我,那就太好了。
最好的祝福!
我只是将posttype更改为“ json”,这为我修复了错误:
res = browser.post('https://www.wg-gesucht.de/ajax/api/Smp/api.php?action=conversations', json=payload, headers=headers)
仍然感谢您的帮助。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句