make request

This commit is contained in:
Davide Alberani 2018-01-20 18:19:41 +01:00
parent b8c2649b69
commit 359c467586

View file

@ -4,6 +4,7 @@
import os import os
import json import json
import logging import logging
import requests
from tornado.ioloop import IOLoop from tornado.ioloop import IOLoop
# from lxml.html.diff import htmldiff # from lxml.html.diff import htmldiff
@ -26,6 +27,7 @@ SCHEDULES_FILE = 'conf/schedules.json'
logger = logging.getLogger() logger = logging.getLogger()
logger.setLevel(logging.INFO) logger.setLevel(logging.INFO)
def read_schedules(): def read_schedules():
if not os.path.isfile(SCHEDULES_FILE): if not os.path.isfile(SCHEDULES_FILE):
return {'schedules': {}} return {'schedules': {}}
@ -63,6 +65,8 @@ def run_job(id_=None, *args, **kwargs):
if not url: if not url:
return return
print('Running job id:%s title:%s url: %s' % (id_, schedule.get('title', ''), url)) print('Running job id:%s title:%s url: %s' % (id_, schedule.get('title', ''), url))
req = requests.get(url, timeout=(30.10, 240))
print(req.text)
def scheduler_update(scheduler, id_): def scheduler_update(scheduler, id_):