-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
36 lines (29 loc) · 925 Bytes
/
config.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"""Configuration file stuff."""
from __future__ import absolute_import
import httplib
import json
import logging
from datetime import date
class Config():
"""Methods for configuration."""
def __init__(self):
"""Init."""
self.config = Config.get_config()
self.today = Config.today()
@classmethod
def today(cls):
return date.today().isoformat()
@classmethod
def get_config(cls):
"""Load config options, such as api key and host url."""
filename = "./data/.config"
with open(filename) as fh:
return json.loads(fh.read())
@classmethod
def set_debug(self):
httplib.HTTPConnection.debuglevel = 1
logging.basicConfig()
logging.getLogger().setLevel(logging.DEBUG)
req_log = logging.getLogger('requests.packages.urllib3')
req_log.setLevel(logging.DEBUG)
req_log.propagate = True