Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

renamed some programs now that this is intended for multiple uses

  • Loading branch information...
commit 97730525c31382bf101aee1ecccc0713b5515fc9 1 parent d777ae5
@devonjones devonjones authored
View
14 tools/tweet.py
@@ -12,13 +12,13 @@ def twitter_auth(config):
auth.set_access_token(config['access_token'], config['access_token_secret'])
return auth
-def get_config():
- if os.path.exists('moartimecube.yaml'):
- return yaml.load(file('moartimecube.yaml', 'r'))['moartimecube']
- elif os.path.exists(os.path.expanduser('~/.moartimecube')):
- return yaml.load(file(os.path.expanduser('~/.moartimecube'), 'r'))['moartimecube']
- elif os.path.exists('/etc/moartimecube.yaml'):
- return yaml.load(file('/etc/moartimecube.yaml', 'r'))['moartimecube']
+def get_config(name):
+ if os.path.exists('%s.yaml' % name):
+ return yaml.load(file('%s.yaml' % name, 'r'))['twitter']
+ elif os.path.exists(os.path.expanduser('~/.%s' % name)):
+ return yaml.load(file(os.path.expanduser('~/.%s' % name), 'r'))['twitter']
+ elif os.path.exists('/etc/%s.yaml' % name):
+ return yaml.load(file('/etc/%s.yaml' % name, 'r'))['twitter']
else:
raise Exception('No config file')
View
3  timecubefollow.py → twitterfollow.py
@@ -44,12 +44,13 @@ def do_follow(api, user, num=0):
def option_parser():
parser = OptionParser(usage="Follows random followers of timecube followers on the Moar Time Cube twitter account.")
parser.add_option("-n", "--num", dest="num", default="10", help="number of random people to follow")
+ parser.add_option("-c", "--config", dest="config", default="moartimecube", help="config name")
return parser
def main():
parser = option_parser()
(options, args) = parser.parse_args()
- config = get_config()
+ config = get_config(options.config)
num = int(options.num)
random.seed(datetime.datetime.now())
follow(config, num)
View
3  timecuberandomuser.py → twitterrandomuser.py
@@ -16,12 +16,13 @@ def random_user(config):
def option_parser():
parser = OptionParser(usage="Follows random followers of timecube followers on the Moar Time Cube twitter account.")
+ parser.add_option("-c", "--config", dest="config", default="moartimecube", help="config name")
return parser
def main():
parser = option_parser()
(options, args) = parser.parse_args()
- config = get_config()
+ config = get_config(options.config)
random.seed(datetime.datetime.now())
random_user(config)
View
3  timecubetrends.py → twittertrends.py
@@ -20,12 +20,13 @@ def trends(config, num):
def option_parser():
parser = OptionParser(usage="Follows random followers of timecube followers on the Moar Time Cube twitter account.")
parser.add_option("-n", "--num", dest="num", default="10", help="number of random people to follow")
+ parser.add_option("-c", "--config", dest="config", default="moartimecube", help="config name")
return parser
def main():
parser = option_parser()
(options, args) = parser.parse_args()
- config = get_config()
+ config = get_config(options.config)
num = int(options.num)
random.seed(datetime.datetime.now())
trends(config, num)
View
3  timecubetweet.py → twittertweet.py
@@ -24,12 +24,13 @@ def tweet(config):
def option_parser():
parser = OptionParser(usage="Posts generated tweets to Moar Time Cube twitter account.")
+ parser.add_option("-c", "--config", dest="config", default="moartimecube", help="config name")
return parser
def main():
parser = option_parser()
(options, args) = parser.parse_args()
- config = get_config()
+ config = get_config(options.config)
random.seed(datetime.datetime.now())
tweet(config)
View
3  timecubeunfollow.py → twitterunfollow.py
@@ -53,12 +53,13 @@ def do_unfollow(api, user, num=0):
def option_parser():
parser = OptionParser(usage="Follows random followers of timecube followers on the Moar Time Cube twitter account.")
parser.add_option("-n", "--num", dest="num", default="10", help="number of random people to follow")
+ parser.add_option("-c", "--config", dest="config", default="moartimecube", help="config name")
return parser
def main():
parser = option_parser()
(options, args) = parser.parse_args()
- config = get_config()
+ config = get_config(options.config)
num = int(options.num)
random.seed(datetime.datetime.now())
unfollow(config, num)
Please sign in to comment.
Something went wrong with that request. Please try again.