Add scheduler

This commit is contained in:
Richard Chien 2016-12-03 17:16:16 +08:00
parent 7da292e13b
commit e1210c4e5e
6 changed files with 12 additions and 10 deletions

2
.gitignore vendored
View File

@ -1,5 +1,3 @@
.idea
*.iml
.DS_Store
*.db
data

View File

@ -10,7 +10,10 @@ class ApiClient:
return newclient
def __call__(self, *args, **kwargs):
return requests.get(self.url, params=kwargs)
try:
return requests.get(self.url, params=kwargs)
except requests.exceptions.ConnectionError:
return None
client = ApiClient('http://127.0.0.1:5000/openqq')

4
app.py
View File

@ -91,7 +91,7 @@ def _index():
return '', 204
def load_commands():
def _load_commands():
command_mod_files = filter(
lambda filename: filename.endswith('.py') and not filename.startswith('_'),
os.listdir(get_commands_dir())
@ -106,5 +106,5 @@ def load_commands():
if __name__ == '__main__':
load_commands()
_load_commands()
app.run(host='127.0.0.1', port=8888)

View File

@ -7,15 +7,15 @@ from little_shit import SkipException, get_command_name_separators
_command_name_seps = get_command_name_separators()
class CommandNotExistsError(BaseException):
class CommandNotExistsError(Exception):
pass
class CommandPermissionError(BaseException):
class CommandPermissionError(Exception):
pass
class CommandScopeError(BaseException):
class CommandScopeError(Exception):
def __init__(self, msg_type):
self.msg_type = msg_type

View File

@ -3,7 +3,7 @@ import os
from config import config
class SkipException(BaseException):
class SkipException(Exception):
pass
@ -25,7 +25,7 @@ def get_db_dir():
def get_default_db_path():
return os.path.join(get_db_dir(), 'default.db')
return os.path.join(get_db_dir(), 'default.sqlite')
def get_tmp_dir():

View File

@ -1,3 +1,4 @@
apscheduler
requests
cachetools
pytz