Python scrapy - Login Authenication Issue
https://stackoverflow.com/questions/37841409/python-scrapy-login-authenication-issue
from scrapy.crawler import CrawlerProcess
import scrapy from scrapy.http import Request class FirstSpider(scrapy.Spider):
name = "first"
allowed_domains = ["instacart.com"]
start_urls = [
"https://www.instacart.com"
] def start_requests(self):
return [Request(url="https://www.instacart.com", callback=self.login)] def login(self, response):
return scrapy.FormRequest('https://www.instacart.com/accounts/login',
headers={"X-Requested-With": "XMLHttpRequest"},
formdata={'user[email]': 'xxxxxxx@gmail.com', 'user[password]': 'xxxxx',
"authenticity_token": response.xpath(
"//meta[@name='csrf-token']/@content").extract_first()},
callback=self.parse,dont_filter=True) def parse(self, response):
print(response.body)
if "Goutam" in response.body:
print "Successfully logged in. Let's start crawling!"
else:
print "Login unsuccessful"
Python scrapy - Login Authenication Issue的更多相关文章
- python scrapy版 极客学院爬虫V2
python scrapy版 极客学院爬虫V2 1 基本技术 使用scrapy 2 这个爬虫的难点是 Request中的headers和cookies 尝试过好多次才成功(模拟登录),否则只能抓免费课 ...
- python Scrapy安装和介绍
python Scrapy安装和介绍 Windows7下安装1.执行easy_install Scrapy Centos6.5下安装 1.库文件安装yum install libxslt-devel ...
- Python.Scrapy.14-scrapy-source-code-analysis-part-4
Scrapy 源代码分析系列-4 scrapy.commands 子包 子包scrapy.commands定义了在命令scrapy中使用的子命令(subcommand): bench, check, ...
- Python.Scrapy.11-scrapy-source-code-analysis-part-1
Scrapy 源代码分析系列-1 spider, spidermanager, crawler, cmdline, command 分析的源代码版本是0.24.6, url: https://gith ...
- python scrapy cannot import name xmlrpc_client的解决方案,解决办法
安装scrapy的时候遇到如下错误的解决办法: "python scrapy cannot import name xmlrpc_client" 先执行 sudo pip unin ...
- 教程+资源,python scrapy实战爬取知乎最性感妹子的爆照合集(12G)!
一.出发点: 之前在知乎看到一位大牛(二胖)写的一篇文章:python爬取知乎最受欢迎的妹子(大概题目是这个,具体记不清了),但是这位二胖哥没有给出源码,而我也没用过python,正好顺便学一学,所以 ...
- 天气提醒邮件服务器(python + scrapy + yagmail)
天气提醒邮件服务器(python + scrapy + yagmail) 项目地址: https://gitee.com/jerry323/weatherReporter 前段时间因为xxx上班有时候 ...
- Python -- Scrapy 框架简单介绍(Scrapy 安装及项目创建)
Python -- Scrapy 框架简单介绍 最近在学习python 爬虫,先后了解学习urllib.urllib2.requests等,后来发现爬虫也有很多框架,而推荐学习最多就是Scrapy框架 ...
- python scrapy,beautifulsoup,regex,sgmparser,request,connection
In [2]: import requests In [3]: s = requests.Session() In [4]: s.headers 如果你是爬虫相关的业务?抓取的网站还各种各样, ...
随机推荐
- LeetCode 728 Self Dividing Numbers 解题报告
题目要求 A self-dividing number is a number that is divisible by every digit it contains. For example, 1 ...
- 2018/05/02 PHP 之错误与异常处理
在学习中,越学习越觉得自己基础薄弱. 在平常工作中,对于某些错误处理感觉不知道怎么下手,于是决定重新再整理一下. 强烈推荐这篇文章,真的感觉学习到了很多. 部分引用::再谈PHP错误与异常处理 -- ...
- 提取json响应结果值_后置处理器JSON Extractor
Json响应格式 json串中{}表示对象,[]表示数组 JSON Extractor使用json path表达式匹配,可以一次取多个变量值. $表示响应的根对象. 取子对象或对象的属性用. 取数组里 ...
- JAVA四大域对象总结
根据有作用范围由小到大: page(jsp有效)------>page域指的是pageContext. request(一次请求)--->request域request HttpServl ...
- centos7安装webmin
安装webmin准备centos7系统1.下载http://download.webmin.com/download/yum/选择:webmin-1.700-1.noarch.rpm 安装包 wget ...
- 【Oracle】使用bbed手动提交事务
有时候数据库挂掉,起库会出现ORA-00704错误,而导致ORA-00704错误的根本原因是訪问OBJ$的时候.ORACLE须要回滚段中的数据,而訪问回滚段的时候须要的undo数据已经被覆盖,此时我们 ...
- centos 安装 pcre
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/luozhonghua2014/article/details/37054235 #rpm -qa | ...
- what's the 二叉树
what's the 树 在了解二叉树之前,首先我们得有树的概念. 树是一种数据结构又可称为树状图,如文档的目录.HTML的文档树都是树结构,它是由n(n>=1)个有限节点组成一个具有层次关系的 ...
- 数据库---mysql内置功能
一.视图 简介: 视图是一个虚拟表(非真实存在),其本质是[根据SQL语句获取动态的数据集,并为其命名],用户使用时只需使用[名称]即可获取结果集,可以将该结果集当做表来使用.使用视图我们可以把查询过 ...
- 前端框架之Vue(10)-全家桶简单使用实例
vue-router官方文档 vuex官方文档 安装 npm install vue-router --save 使用实例 vue-router初使用(webpack-simple模板) 1.切换到指 ...