]> rtime.felk.cvut.cz Git - hubacji1/coffee-getter.git/blob - cbgetter.py
Merge branch 'feature/coffeebot-getter'
[hubacji1/coffee-getter.git] / cbgetter.py
1 # -*- coding: utf-8 -*-
2 """Get data from database and publish them."""
3 from json import dumps
4 from requests import post
5 from cbconf import Conf
6 from cbdb import Db
7
8 class CoffeebotGetter:
9     """This class connects configuration, database access and publishing."""
10     def __init__(self):
11         self.cfg = Conf()
12         self.db = Db(self.cfg.getCoffeeDbPath())
13         self.msg = ""
14         return None
15
16     def getMsg(self):
17         """Return message."""
18         return self.msg
19
20     def sendMsgToSlack(self):
21         """Send message to Slack Bot."""
22         return post(self.cfg.getCoffeebotURL(), dumps({"text": self.msg}))