Permalink
Browse files

Initial (ugly) commit

  • Loading branch information...
David Crosby
David Crosby committed Jan 15, 2016
0 parents commit 7c94f320c84fc086e91bdf8922d647d6d8b65a0d
Showing with 60 additions and 0 deletions.
  1. +10 −0 LICENSE
  2. +48 −0 coffeeoutsidebot.py
  3. +2 −0 winter_locations
10 LICENSE
@@ -0,0 +1,10 @@
Copyright (c) 2016, David Crosby
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,48 @@
#!/usr/bin/env python
# CoffeeOutsideBot
# Copyright 2016, David Crosby
# BSD 2-clause license
#
# TODO - add rest of the locations, etc
# TODO - automate weather forecast lookup
# TODO - automate Cyclepalooza event creation
# TODO - clean this ugly thing up
import json
import random
from twitter import *
from ConfigParser import SafeConfigParser
parser = SafeConfigParser()
parser.read('./cb_config.ini')
tcreds = {}
# yuck
for section in ['twitter']:
if parser.has_section(section):
if section == 'twitter':
for option in parser.options('twitter'):
tcreds[option] = parser.get('twitter', option)
print(tcreds)
locations = []
try:
with open('./winter_locations', 'r') as file_handle:
for l in file_handle:
if len(l.strip()) > 0:
locations.append(l.strip())
except IOError, err:
print(err)
print(locations)
location = random.choice(locations)
new_status = "The next #CoffeeOutside is at " + location
print(new_status)
# The Twitter Bits
t = Twitter(
auth=OAuth(tcreds['token'], tcreds['token_secret'], tcreds['consumer_key'], tcreds['consumer_secret']))
t.statuses.update(status=new_status)
@@ -0,0 +1,2 @@
Enmax Stage on Princes Island
Ice Rink at Olympic Plaza

0 comments on commit 7c94f32

Please sign in to comment.