0
点赞
收藏
分享

微信扫一扫

爬虫爬虫405 Not Allowed Request Payload


本人由爬虫已转web,既然有人问再次更新一下吧

检查请求方法是否正确 get post

请求传入参数是否正确, 根据Content-Type 请求或返回内容类型

post传入参数​​formdata​​​ 、​​application/json​

(通常因为请求参数类型二)

爬虫爬虫405 Not Allowed    Request  Payload_请求参数

application/json: JSON数据格式
application/x-www-form-urlencoded中 表单默认的提交数据的格式
multipart/form-data 需要在表单中进行文件上传时,就需要使用该格式

请求参数类型一

爬虫爬虫405 Not Allowed    Request  Payload_json_02

爬虫爬虫405 Not Allowed    Request  Payload_请求参数_03

爬虫爬虫405 Not Allowed    Request  Payload_json_04

请求参数类型二

爬虫爬虫405 Not Allowed    Request  Payload_请求参数_05


爬虫爬虫405 Not Allowed    Request  Payload_表单_06

暂时没发现此类请求 ​​application/json​

参数类型为 json数据, 注意引号为双引号,
如果为单引号请使用 ,也可能报错 Not Allowed Request Payload
可用 ​​​data=json.dumps(self.post_data)​

{"username": "zhagnsan", “password": "123456"}

import requests
import json

class InfoTec(object):
def __init__(self):

self.headers = {
'user-agent': 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3**8.77 Safari/537.36'
}
self.post_data = {
"AccountId": 'null',
"TagId": 'null',
"Current": 9,
"Psize": 9
}

def index_page(self):

url = 'https://api.*******icles'
response = requests.post(url, data=json.dumps(self.post_data), headers=self.headers)
return response.text

def run(self):

res = self.index_page()
print(res)

if __name__ == '__main__':
infotec = InfoTec()
infotec.run()

405 介绍

​​https://www.checkupdown.com/status/E405_zh.html​​


举报

相关推荐

0 条评论