diff options
author | neodarz <neodarz@neodarz.net> | 2019-01-17 22:39:56 +0100 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2019-01-17 22:39:56 +0100 |
commit | 073e919ef198a04da1e5ed28a7dfbc5d9681fc14 (patch) | |
tree | cd8a60cb0eb261489c5d1e5008c99101628e5b9b /crawler/neodarznet | |
parent | 82aefaaaf1c0fc64e584f7025259f84d2bcc347b (diff) | |
download | khanindexer-073e919ef198a04da1e5ed28a7dfbc5d9681fc14.tar.xz khanindexer-073e919ef198a04da1e5ed28a7dfbc5d9681fc14.zip |
Be more specific on index source database
Diffstat (limited to '')
-rw-r--r-- | crawler/neodarznet/pipelines.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crawler/neodarznet/pipelines.py b/crawler/neodarznet/pipelines.py index 6703796..fbfebbb 100644 --- a/crawler/neodarznet/pipelines.py +++ b/crawler/neodarznet/pipelines.py @@ -1,19 +1,19 @@ # -*- coding: utf-8 -*- import logging -from database.models import Page +from database.models import Neodarznet class NeodarznetPipeline(object): def process_item(self, item, spider): try: - page = Page.get(Page.url == item['url']) - q = Page.update(**item).where(Page.url == item['url']) + page = Neodarznet.get(Neodarznet.url == item['url']) + q = Neodarznet.update(**item).where(Neodarznet.url == item['url']) q.execute() logging.info("Update item {}".format(page)) - except Page.DoesNotExist: - page = Page.create(**item) + except Neodarznet.DoesNotExist: + page = Neodarznet.create(**item) logging.info("Create item {}".format(page)) logging.info('Item {} stored in db'.format(page)) return item |