Skip to content

Commit bd54f46

Browse files
author
Germey
committed
to scrapytutorial
1 parent e8342df commit bd54f46

File tree

15 files changed

+20
-19
lines changed

15 files changed

+20
-19
lines changed

scrapy.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# https://scrapyd.readthedocs.org/en/latest/deploy.html
55

66
[settings]
7-
default = tutorial.settings
7+
default = scrapytutorial.settings
88

99
[deploy]
1010
#url = http://localhost:6800/
11-
project = tutorial
11+
project = scrapytutorial
File renamed without changes.
File renamed without changes.
File renamed without changes.

tutorial/pipelines.py renamed to scrapytutorial/pipelines.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
class TextPipeline(object):
66
def __init__(self):
77
self.limit = 50
8-
8+
99
def process_item(self, item, spider):
1010
if item['text']:
1111
if len(item['text']) > self.limit:
@@ -19,22 +19,23 @@ class MongoDBPipeline(object):
1919
def __init__(self, connection_string, database):
2020
self.connection_string = connection_string
2121
self.database = database
22-
22+
2323
@classmethod
2424
def from_crawler(cls, crawler):
2525
return cls(
26-
connection_string=crawler.settings.get('MONGODB_CONNECTION_STRING'),
26+
connection_string=crawler.settings.get(
27+
'MONGODB_CONNECTION_STRING'),
2728
database=crawler.settings.get('MONGODB_DATABASE')
2829
)
29-
30+
3031
def open_spider(self, spider):
3132
self.client = pymongo.MongoClient(self.connection_string)
3233
self.db = self.client[self.database]
33-
34+
3435
def process_item(self, item, spider):
3536
name = item.__class__.__name__
3637
self.db[name].insert(dict(item))
3738
return item
38-
39+
3940
def close_spider(self, spider):
4041
self.client.close()
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)