Last active
March 3, 2017 00:05
-
-
Save necrobuffalo/5c1c7eae0eb01d73457064fa6ec55891 to your computer and use it in GitHub Desktop.
foodbot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[trello] | |
api_key=from site | |
api_secret=from site | |
token=from oauth | |
token_secret=from oauth | |
board=groceries | |
[notify] | |
pushbullet_token=from site |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from trello import TrelloClient | |
from pushbullet import Pushbullet | |
import random | |
import configparser | |
config = configparser.ConfigParser() | |
config.read('bot.cfg') | |
client = TrelloClient( | |
api_key=config['trello']['api_key'], | |
api_secret=config['trello']['api_secret'], | |
token=config['trello']['token'], | |
token_secret=config['trello']['token_secret'] | |
) | |
starch = client.search("board:{} label:starch list:have".format(config['trello']['board'])) | |
vegetable = client.search("board:{} label:vegetable list:have".format(config['trello']['board'])) | |
protein = client.search("board:{} label:protein list:have".format(config['trello']['board'])) | |
text = "{}, {}, {}".format(random.choice(starch).name,random.choice(vegetable).name,random.choice(protein).name) | |
pb = Pushbullet(config['notify']['pushbullet_token']) | |
pb.push_note("Go eat something.", text) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment