mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-21 17:21:09 +01:00
26 lines
552 B
Python
26 lines
552 B
Python
from app import api
|
|
from routes.base import BaseApi
|
|
from tasks.spider import get_baidu_html
|
|
|
|
|
|
class TestApi(BaseApi):
|
|
col_name = 'test'
|
|
|
|
def __init__(self):
|
|
super(TestApi).__init__()
|
|
self.parser.add_argument('keyword', type=str)
|
|
|
|
def get(self, id=None):
|
|
args = self.parser.parse_args()
|
|
for i in range(100):
|
|
get_baidu_html.delay(args.keyword)
|
|
return {
|
|
'status': 'ok'
|
|
}
|
|
|
|
|
|
# add api to resources
|
|
api.add_resource(TestApi,
|
|
'/api/test',
|
|
)
|