首页 > 技术文章 > python抓取页面遇到405处理

ministep 2021-04-13 11:32 原文

Response 405 using Python Requests

The following code is working for me:

import requests

url = 'https://peepoo.gq/sign'

payload = {'content' : 'pickle rick'}

headers = {
'content-type' : 'application/x-www-form-urlencoded',
}

params = {'guestbook_name' : 'main'}

r = requests.post(url, data=payload, headers=headers, params=params, allow_redirects=True)

If you read the error description, it actually says the reason.

"The method POST is not allowed for this resource."

Response 405 using Python Requests - Stack Overflow]

推荐阅读