mirror of
https://github.com/chubin/wttr.in
synced 2024-12-24 02:43:07 +00:00
moved limits to globals.py (fixes #233)
This commit is contained in:
parent
7303ae86ba
commit
95e1f61a40
2 changed files with 6 additions and 2 deletions
|
@ -41,6 +41,10 @@ MALFORMED_RESPONSE_HTML_PAGE = open(os.path.join(STATIC, 'malformed-response.htm
|
|||
|
||||
GEOLOCATOR_SERVICE = 'http://localhost:8004'
|
||||
|
||||
# number of queries from the same IP address is limited
|
||||
# (minute, hour, day) limitations:
|
||||
QUERY_LIMITS = (300, 3600, 24*3600)
|
||||
|
||||
LISTEN_HOST = ""
|
||||
LISTEN_PORT = 8002
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ from globals import get_help_file, log, \
|
|||
NOT_FOUND_LOCATION, \
|
||||
MALFORMED_RESPONSE_HTML_PAGE, \
|
||||
PLAIN_TEXT_AGENTS, PLAIN_TEXT_PAGES, \
|
||||
MY_EXTERNAL_IP
|
||||
MY_EXTERNAL_IP, QUERY_LIMITS
|
||||
from location import is_location_blocked, location_processing
|
||||
from limits import Limits
|
||||
from wttr import get_wetter, get_moon
|
||||
|
@ -28,7 +28,7 @@ if not os.path.exists(os.path.dirname(LOG_FILE)):
|
|||
os.makedirs(os.path.dirname(LOG_FILE))
|
||||
logging.basicConfig(filename=LOG_FILE, level=logging.DEBUG, format='%(asctime)s %(message)s')
|
||||
|
||||
LIMITS = Limits(whitelist=[MY_EXTERNAL_IP], limits=(30, 60, 100))
|
||||
LIMITS = Limits(whitelist=[MY_EXTERNAL_IP], limits=QUERY_LIMITS)
|
||||
|
||||
def show_text_file(name, lang):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue