def main(): weed = Weed() if 'tweet' in sys.argv: post_tweet(weed.generate()) else: for _ in range(10): print(weed.generate())
def main(): gen = HaikuGen() haiku = gen.haiku() if post_tweet and 'tweet' in sys.argv: post_tweet(gen.format(haiku)) elif 'json' in sys.argv: print(json.dumps(haiku)) else: print(gen.format(haiku))
def main(): ap = argparse.ArgumentParser() ap.add_argument('-t', '--tweet', action='store_true') args = ap.parse_args() if args.tweet: titles = tuple(botechre()) if titles: post_tweet(titles[0]) else: lines = botechre(10) print('\n'.join(lines))
def tweet(): # notice that we're pulling the value of tweet-status from the request # this is what you typed into the web form tweet_status = request.forms.get('tweet-status') # call post_tweet from module tweet, pass in the tweet_status post_tweet(tweet_status) # call get_tweets from the tweet module, sotre the result in a variable called tweets tweets = get_tweets() # just as you did in the get_index() function call template and return its result return template('simple', tweets=tweets)
def post_to_twitter(question, answers, time_start=5, time_end=10): from tweet import post_tweet, reply_tweet main_name = question.keys()[0] main_quote = question[main_name] tweet = main_name + ": " + main_quote + " #codecampCC" reply_id = post_tweet(tweet) print reply_id print tweet sleep(random.randrange(time_start, time_end)) names = [] for name, quote in answers.iteritems(): tweet = name + ": " + main_quote.replace("___", "[" + quote + "]") reply_tweet(tweet, reply_id) print tweet names.append(name) sleep(random.randrange(time_start, time_end)) # rand_name = names[random.randint(0, len(names)-1)] #tweet = main_name + ": " + rand_name + " is the one that I like the most. Others are stupid." #reply_tweet(tweet, reply_id) #print tweet #print return reply_id
def main_tweet(): wb = WordBank(WORDBANK_FILENAME) word = wb.any_pending_word() text = snake(word) tweet = post_tweet(text) if tweet: wb[word] = tweet else: sys.stderr.write('No tweet saved for "%s"\n' % word)
def main(): print("Project Starting!") credential_loader.load_creds() anyl.set_keys(credential_loader.get_acs_creds()) get_data.set_globals(credential_loader.get_twitter_creds()) trending.set_globals(credential_loader.get_twitter_creds()) tweet.set_globals(credential_loader.get_twitter_creds()) pngs = [] trends = trending.top_ten_trending() for trend in trends: tweets = get_data.hashtag_pull(trend, 60) feels = anyl.sent_analysis(tweets) vis.piechart_gen(feels['positive'], feels['negative'], feels['neutral'], "Twitters feeling on " + trend, trend) path = "out/" + trend + ".png" pngs.append(path) tweet.post_tweet(trend, path) for name in pngs: clear_used_charts(name)
import potd import posttoot import tweet from datetime import date from PIL import Image from resizeimage import resizeimage #extract pic of the day imgdata = potd.fetch_potd(cur_date=date.today()) imgsrc = imgdata['image_src'] pageurl = imgdata['image_page_url'] potd.saveimg(imgsrc) #fileconvertion fd_img = open("picoftheday.jpg", 'rb') img = Image.open(fd_img) img = resizeimage.resize_contain(img, [1280, 1280]) img.save("resize.png", img.format) fd_img.close() #toot posttoot.post("resize.png", imgsrc, pageurl) print("Sucessfully posted your toot") tweet.post_tweet("resize.png", imgsrc, pageurl) print("Sucessfully posted your tweet")
from pathlib import Path from datetime import datetime import pandas as pd import tweet as t home = '/Users/colinspear/dev/vanity_plates/' df = pd.read_csv(home + 'data/clean_rejections.csv') tweet = t.make_tweet(df) t.post_tweet(tweet) print(f"{datetime.now().strftime('%Y-%m-%d %X')} tweet sent")
from tweet import post_tweet post_tweet()
selected_players = select_players(czar, players) czar_cards = load_character_cards(czar) players_cards = { player: load_character_cards(player) for player in selected_players } selected_czar_card = select_czar_card(czar_cards) selected_players_cards = { player: select_player_card(selected_czar_card, players_cards) for player, players_cards in players_cards.iteritems() } print "twitting..." reply_id = post_tweet(czar + ": " + selected_czar_card.black_string()) sleep(reply_delay) for player, selected_player_card in selected_players_cards.iteritems( ): reply_tweet( player + ": " + selected_czar_card.black_string().replace( "___", "[" + selected_player_card.white_string().lower() + "]"), reply_id) sleep(reply_delay) """ print "selecting a winner" sleep(20)
def job(): print("I'm working...") post_tweet()