首先Scrapy 发送payload请求格式如下:

    def start_requests(self):
querystr = {
"ctoken": "U-ang1zmpP6c3VO4",
"sceneKey": "DEFAULT",
"pdKey": "P_ECTBILL_QUOTATION1",
}
payload = {
"executeKey": "E_QUOTATION-RATE_QUERY_NEW",
"pdKey": "P_ECTBILL_QUOTATION1",
"requestJson": '[{"acceptBankNo":"313143005157","bankLevel":"04","beginReceiptMoney":"0","endReceiptMoney":"500000","billReceiptMoney":"20000","expireDay":1577783940394,"billBizType":"KHT"}]',
"sceneKey": "DEFAULT",
}
data = json.dumps(payload)   # payload格式需要用dumps转成string
api = self.url + urlencode(querystr)   # Query string parameter
yield Request(url=api, method='POST', body=data, callback=self.parse, headers=self.headers)

报错的原因是因为header中有带参数 HOST, Content-Length, 屏蔽掉这两个参数就行了,最好是养成习惯header中都不要带这两个参数 .

原因可参考:https://stackoverflow.com/questions/42248903/scrapy-post-request-not-working-400-bad-request

Scrapy payload 报错400的更多相关文章

  1. Python_爬虫 Scrapy 安装报错一整套处理流程

    安装顺序 scrapy 需要的依赖很多.首先需要   twisted  如果没有这个 直接安装  scrapy  会报错 要求你安装一个 vis 14 还是什么的环境,那个东西如果真的要装要 6g 但 ...

  2. RSS阅读器“阅读原文”报错400

    问题 使用SpringMVC框架,实现了RSS订阅,在FoxMail的RSS订阅页面,点击[阅读原文],报错400 . 每个RSS文章的链接是:https://jiashubing.cn/forum/ ...

  3. Scrapy安装报错 Microsoft Visual C++ 14.0 is required 解决办法

    Scrapy安装报错 Microsoft Visual C++ 14.0 is required 解决办法原因:Scrapy需要的组 twisted 需要 C++环境编译. 方法一:根据错误提示去对应 ...

  4. Scrapy运行报错:ModuleNotFoundError: No module named 'douban.douban'

    运行scrapy爬虫报错: from douban.douban.items import DoubanItem ModuleNotFoundError: No module named 'douba ...

  5. svn报错 400 Bad Request

    MyEclipse中的svn,commit经常报错 Error: Commit failed (details follow):  Error: At least one property chang ...

  6. Scrapy运行报错解决方案

    最近在学习Scrapy框架,用博客记录一下遇到的错误的解决方案 时间: 2016-9-20 错误:ImportError: No module named items 原因:spiders下的.py文 ...

  7. ajax 调用 .net core WebAPI,报错 400 (Bad Request) Unexpected character encountered while parsing value

    此文由博主前两天的提问及 dudu 的回答整理,地址:https://q.cnblogs.com/list/myquestion 情况说明 基于 .net core 写了一个 Web API,用 po ...

  8. Scrapy安装报错

    python3 pip 安装Scrapy在win10 安装报错error: Microsoft Visual C++ 14.0 is required. Get it with "Micro ...

  9. window安装Scrapy———解决报错问题

    系统是WIN10 64位Python是3.5.2今天安装pip install Scrapy  来安装发现报错Microsoft Visual C++ 14.0 is required 检查发现电脑中 ...

随机推荐

  1. GAN生成式对抗网络(一)——原理

    生成式对抗网络(GAN, Generative Adversarial Networks )是一种深度学习模型 GAN包括两个核心模块. 1.生成器模块 --generator 2.判别器模块--de ...

  2. Android Jenkins 自动化打包构建

    前言 在测试app项目过程中,通常都是需要开发打测试包给到测试,但是无论是iOS还是Android的打包过程都是相当漫长的,频繁的回归测试需要频繁的打包,对于开发同学影响还是蛮大的.因此在这种情况下, ...

  3. Servlet中接收和返回数据

    public class HelloServlet extends HttpServlet { @Override protected void doGet(HttpServletRequest re ...

  4. 总结:Apache/Tomcat/JBOSS/Jetty/Nginx区别 .

    总结:Apache/Tomcat/JBOSS/Nginx区别 .1.Apache是Web服务器,Tomcat是应用(Java)服务器.Tomcat在中小型系统和并发访问用户不是很多的场合下被普遍使用. ...

  5. JAVA基础知识|HTTP协议-两个特性

    一.无连接 无连接:服务器与浏览器之间的一次连接只处理一个http请求,请求处理结束后,连接断开.下一次请求再重新建立连接. 然而随着互联网的发展,一台服务器同一时间处理的请求越来越多,如果依然采用原 ...

  6. 一个简单的puppeteer爬虫

    const puppeteer = require("puppeteer"); const path = require('path'); const pathToExtensio ...

  7. 在windows平台下搭建Django项目虚拟环境

    参考文档:https://www.cnblogs.com/lovele-/p/8719126.html  https://blog.csdn.net/lwcaiCSDN/article/details ...

  8. selenium 配置 chromedriver

    参考文档: https://blog.csdn.net/yoyocat915/article/details/80580066?tdsourcetag=s_pcqq_aiomsg http://npm ...

  9. MySQL中information_schema数据库是干啥的

    大家在安装或使用MYSQL时,会发现除了自己安装的数据库以外,还有一个 information_schema数据库.information_schema数据库是做什么用的呢,使用WordPress博客 ...

  10. fork() 成为负担,需要淘汰 spawn

    A fork() in the road - Microsoft Research https://www.microsoft.com/en-us/research/publication/a-for ...