-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanage.py
More file actions
executable file
·23 lines (20 loc) · 985 Bytes
/
manage.py
File metadata and controls
executable file
·23 lines (20 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: utf-8 -*-
import argparse
__author__ = 'wataru'
if __name__ == '__main__':
#エラーの時にメッセージを表示する。
parser = argparse.ArgumentParser("Runner")
parser.add_argument('action', type=str, nargs=None, help="Select target 'crawler' or 'webpage'?")
args = parser.parse_args()
if args.action == 'crawler':
#コマンドラインでcrawlerって打ち込まれたらweb_crawlerって言うフォルダからcrawler.pyを読み込んでcrawl_webっていうdefを持ってくる
from web_crawler.crawler import crawl_web
crawl_web('https://www.aasa.ac.jp/', 15)
elif args.action == 'webpage':
from search_engine import app
app.run(debug=True, host='0.0.0.0', port=9000)
elif args.action == 'dropdb':
from web_crawler.drop_collection import drop_collection
drop_collection()
else:
raise ValueError('Please select "crawler" or "webpage" or "dropdb".')