Skip to content

Commit 340cdf0

Browse files
committed
Update default_project files
1 parent a4df674 commit 340cdf0

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed

grab/util/default_project/database.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import pymongo
2+
3+
db = pymongo.Connection()['{{ PROJECT_NAME }}']

grab/util/default_project/script/__init__.py

Whitespace-only changes.

grab/util/default_project/settings.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
GRAB_SPIDER_MODULES = ['spider']
2+
3+
GRAB_PROXY_LIST = {
4+
'source': '/web/proxy.txt',
5+
'source_type': 'text_file',
6+
}
7+
8+
# GRAB_CACHE = {
9+
# 'backend': 'mysql',
10+
# 'database': '{{ PROJECT_NAME }}_cache',
11+
# 'user': '',
12+
# 'passwd': '',
13+
# }
14+
15+
# GRAB_THREAD_NUMBER = 15
16+
17+
# GRAB_QUEUE = {
18+
# 'backend': 'redis',
19+
# }
20+
21+
# GRAB_TASK_REFRESH_CACHE = {
22+
# 'foo': True,
23+
# }

grab/util/default_project/spider.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# !/usr/bin/env python
2+
# coding: utf-8
3+
from grab.spider import Spider, Task
4+
from weblib.logs import default_logging
5+
from grab import Grab
6+
import logging
7+
8+
from database import db
9+
10+
11+
class {{ PROJECT_NAME_CAMELCASE }}Spider(Spider): # noqa
12+
def task_generator(self):
13+
yield Task('initial', url='')
14+
15+
def task_initial(self, grab, task):
16+
pass

0 commit comments

Comments
 (0)