当前位置:网站首页>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=回调函数)
有知道正确原因的同学可以指导一下,万分感谢
边栏推荐
- Learn Tai Chi Maker - mqtt (IV) server connection operation
- OpenAPI 3.0 specification - Food Guide
- Sloppy formula
- Digital commodity DGE -- the dark horse of wealth in digital economy
- golang--channal与select
- 分布式电商项目 谷粒商城 学习笔记<3>
- Cow sequencing problem
- What happens when the cloud answer does not display the third-party login button
- 我在中山,到哪里开户比较好?网上开户是否安全么?
- 如何在 R 中的绘图中添加回归方程
猜你喜欢

How to check and cancel subscription auto renewal on iPhone or iPad

【flask入门系列】flask处理请求和处理响应

Win10 computer power management turns on excellence mode

Classic quotations from "human nature you must not know"

What can Arthas do for you?
![[machine learning] case study of college entrance examination prediction based on multiple time series](/img/13/7368a169d07e01d86a2d2c0207ccca.png)
[machine learning] case study of college entrance examination prediction based on multiple time series
![[机器翻译]—BLEU值的计算](/img/c3/8f98db33eb0ab5a016621d21d971e4.png)
[机器翻译]—BLEU值的计算

Learn from Taiji makers - mqtt (V) publish, subscribe and unsubscribe

Pie chart metamorphosis record, the liver has 3000 words, collection is to learn!

Google 推荐在 MVVM 架构中使用 Kotlin Flow
随机推荐
Explain the JVM clearly at one time and don't be asked by the interviewer again
R 语言马尔可夫链蒙特卡洛:实用介绍
The "more" option of Spreadtrum platform dearmcamera2 is removed
Binary search
I am in Zhongshan. Where can I open an account? Is it safe to open an account online?
Is it safe to trade stocks with a compass? How does the compass trade stocks? Do you need to open an account
Learn Tai Chi Maker - mqtt (IV) server connection operation
[solution] cmake was unable to find a build program corresponding to "UNIX makefiles"
UTONMOS:以数字藏品助力华夏文化传承和数字科技发展
OpenAPI 3.0 规范-食用指南
小 P 周刊 Vol.10
如何在 R 中的绘图中添加回归方程
Fresh graduates talk about their graduation stories
100002nd prime
2022年挖财商学院证券开户安全嘛?
Chapter I: essential information collection of penetration test
请指教同花顺开户选选择哪家券商比较好?网上开户是否安全么?
Can the main RF circuit be removed for projects that do not need the main RF?
Never criticize
[flask introduction series] flask processing request and response