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 如果你是爬虫相关的业务?抓取的网站还各种各样, ...
随机推荐
- python编码类型互转总结
1.只有在unicode下才能将utf-8与gbk互转2.unicode是在内存中使用,bytes是文件存储和网络传输时使用-------------------------------------- ...
- 内核态与用户态通信 之 sockopt
转自:http://blog.csdn.net/jk110333/article/details/8642261 用户态与内核态交互通信的方法不止一种,sockopt是比较方便的一个,写法也简单. ...
- java 线程 (一) Thread
package cn.sasa.demo1; public class Test { public static void main(String[] args) throws Interrupted ...
- Phone list(Trie树模板)
Phone List 共t组数据,给定n个长度不超过10的字符串,问其中是否存在两个数S,T,使得S是T的前缀. 存在则输出NO,不存在输出YES 输入样例#1: 2 3 911 97625999 9 ...
- pl/sql中文乱码
增加系统变量变量名:NLS_LANG变量值:SIMPLIFIED CHINESE_CHINA.ZHS16GBK
- Magento 2数据库EAV模型结构
EAV模型是一种数据模型 ,用于描述实体的数量预计会很大,但事实上,实体中要使用的属性数量并不多. Magento 2这么设计是为了灵活性,在不影响主干的基础上,任意新增删除属性. EAV模型(E ...
- PHP适配器模式
[IDatabase.php] <?php /** * 适配器模式 * 可以将不同的函数接口封装成统一的API * 应用举例1:数据库操作 mysql/mysqli/pdo * 应用举例2:缓存 ...
- eclipse中Tomcat服务器缓存位置,以及清理Tomcat缓存
在Eclipse中进行Web开发,一般都会将项目直接在Eclipse中的Tomcat服务器运行,有时候修改了程序和页面之后,运行结果还是原来的 tomcat服务器中缓存的程序或者页面,需要清理缓存之后 ...
- nginx_tcp模块集成到openresty(安装ngx_tcp_lua_module模块)
git地址:https://github.com/bigplum/nginx-tcp-lua-module openresty 本身是使用http协议进行通讯的, 但是项目中经常有要求输入是使用tcp ...
- Py中的矩阵乘法【转载】
转自:https://blog.csdn.net/cqk0100/article/details/76221749 1.总结 对于array对象,*和np.multiply函数代表的是数量积,如果希望 ...