Total Complexity | 4 |
Total Lines | 22 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | # -*- coding: utf-8 -*- |
||
2 | import scrapy |
||
3 | |||
4 | |||
5 | class AmazonChecker(scrapy.Spider): |
||
6 | name = 'AmazonChecker' |
||
7 | allowed_domains = ['amazon.fr'] |
||
8 | start_urls = ['https://www.amazon.fr/ap/signin?_encoding=UTF8&ignoreAuthState=1&openid.assoc_handle=frflex&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&openid.pape.max_auth_age=0&openid.return_to=https%3A%2F%2Fwww.amazon.fr%2F%3Fref_%3Dnav_custrec_signin&switch_account='] |
||
9 | |||
10 | def parse(self, response): |
||
11 | if not self.username or not self.password: |
||
12 | print ('pas bon') |
||
13 | else: |
||
14 | return scrapy.FormRequest.from_response( |
||
15 | response, |
||
16 | formdata={'username': self.username, 'password': self.password}, |
||
17 | callback=self.after_login |
||
18 | ) |
||
19 | |||
20 | def after_login(self, response): |
||
21 | print (response.body) |
||
22 |