我正在嘗試向名為www.bazos.sk的網站發送發布請求。這個網站是一個廣告網站,你可以上傳你的東西來賣(它就像 ebay,但要小得多)。發布后,網站回傳重定向的下一個 HTML。如果我手動上傳廣告,我會得到表明它已成功上傳的 HTML,但如果我發布它,我會得到回傳碼 200(因此它已成功發送),但 HTML 顯示(斯洛伐克語)它不是上傳。我認為我的代碼中缺少某些內容(我正在嘗試獲取缺少的內容,但我做不到)。
我測驗了,我可以輕松洗掉廣告,但是如您所見,我無法上傳它們。
這是我的代碼(此代碼中所需的所有個人資料都是假的):
import requests
url = 'https://deti.bazos.sk/insert.php'
data = {
'category': '122',
'nadpis': 'test', #nadpis = title
'popis': 'test', #popis = description
'cena': '1', #cena = price
'cenavyber': '1', #cenavyber = choosable price
'lokalita': '03403', #lokalita = where is the advertisement located
'jmeno': 'XXXXX', #jmeno = name
'telefoni': '8374827543', #telefoni = phone number
'maili': '[email protected]', #maili = mail
'heslobazar': 'XXXXXXXX20', #heslobazar = password
'werwe': 'fsfwereg',
'Submit': 'Odosla?'
}
print("Processing...")
response = requests.post(url, data=data)
print(response.status_code, response.reason)
print(response.text)
input("Press [ENTER] to quit")
I tried with replacing data=data to json=data, nothing. And the url is right, because as you can see, on the beginning of the post the url is www.bazos.sk but in the code it is deti.bazos.sk , the reason for this in short: This website has multiple categories, and has a different url name for each category.
I add pictures too of the network datas:
- https://i.stack.imgur.com/QqTeN.png
- https://i.stack.imgur.com/uVcMi.png
- https://i.stack.imgur.com/bcMRC.png
- https://i.stack.imgur.com/VODIj.png
- https://i.stack.imgur.com/8PKv6.png
uj5u.com熱心網友回復:
向您的請求添加身份驗證、API 特定 Cookie。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/442885.html
標籤:python post python-requests
上一篇:將GET請求轉換為POST請求以加載生成的PDF檔案
下一篇:如果POST不在預檢OPTIONS回應的Access-Control-Allow-Methods值中,瀏覽器會阻止POST請求嗎?
