当前位置:网站首页>scrapy返回400
scrapy返回400
2022-06-26 02:19:00 【0&1菜菜】
- 场景
使用scrapy对数据进行抓取,需要传递的参数是Request Payload参数,使用Resquest发送post请求 - 代码如下
这是返回400的代码
yield scrapy.Request(url=url,
method="POST",
headers={
"Content-Type":"application/json","Host":"web.hi-teeth.com","Content-Length":"18"},
encoding="utf-8",
body=json.dumps({
"key":"value"}),
dont_filter=True,
callback=回调函数)
原因
头部信息中的"Content-Length":"18"造成的错误信息,取消掉就可以,个人任务可能是限制为18造成长度不足的错误解决方案
去掉头部信息中的"Content-Length"即可
正确代码
yield scrapy.Request(url=url,
method="POST",
headers={
"Content-Type":"application/json","Host":"web.hi-teeth.com"},
encoding="utf-8",
body=json.dumps({
"key":"value"}),
dont_filter=True,
callback=回调函数)
有知道正确原因的同学可以指导一下,万分感谢
边栏推荐
- Additional: brief description of hikaricp connection pool; (I didn't go deep into it, but I had a basic understanding of hikaricp connection pool)
- Learn from Taiji makers - mqtt (V) publish, subscribe and unsubscribe
- How to solve the problem that the iPhone 13 lock screen cannot receive the wechat notification prompt?
- Explain the JVM clearly at one time and don't be asked by the interviewer again
- 数据库查询语句SQL中like、%、-的区别
- How to adjust face input size
- 无法上网问题解决过程
- Audio video and CPU architecture
- Cow sequencing problem
- Thirty ninth step
猜你喜欢

df报错Stale file handle

OpenAPI 3.0 规范-食用指南

Additional: brief description of hikaricp connection pool; (I didn't go deep into it, but I had a basic understanding of hikaricp connection pool)

How to prompt

【解决】联想拯救者vmware启动虚拟机蓝屏重启问题

Camtasia 2022 new ultra clear recording computer video

Possible values for @supply in kotlin

Depth first traversal of Graphs

【机器学习】基于多元时间序列对高考预测分析案例
![[defect detection] automatic defect detection of printed circuit board based on Matlab GUI [including Matlab source code 1912]](/img/c4/75f4209c1fa02a192f79de92dc9ecb.png)
[defect detection] automatic defect detection of printed circuit board based on Matlab GUI [including Matlab source code 1912]
随机推荐
How to add a regression equation to a plot in R
Overview of orb-slam3 paper
Camtasia 2022全新版超清录制电脑视频
Which securities company is better and safer to open a mobile stock account?
Arduino string to hexadecimal number for large color serial port screen.
学习太极创客 — MQTT(五)发布、订阅和取消订阅
限制输入字符长度length英文1个字符中文2个字符
Arthas(阿尔萨斯) 能为你做什么?
Implement decorator pattern for servicecollection
Cox 回归模型
2021-08-04
Learn from Taiji makers - mqtt (V) publish, subscribe and unsubscribe
Teach you to quickly record sounds on PC web pages as audio files
How to open a stock account? Is it safe to open an account online?
Introduction to bloc: detailed explanation of cube
用指南针交易股票安全吗?指南针是如何交易股票的,需要开户吗
Install development cross process communication
Multi surveyor Gongshu Xiao sir_ The solution of using websocket error reporting under working directory
. Net7 miniapi (special part):preview5 optimizes JWT verification (Part 2)
A high-frequency interview question from a large factory: tell me about the solution of high and low interface idempotence? Solutions are attached.