From 71d149507e326c75db7e64687484dd71f0412f43 Mon Sep 17 00:00:00 2001 From: Nico Rey Date: Thu, 13 Sep 2018 09:21:01 -0300 Subject: [PATCH] Post pictures to twitter --- post.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 post.py diff --git a/post.py b/post.py new file mode 100755 index 0000000..b6f2d14 --- /dev/null +++ b/post.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python2 +import sys +import tweepy + +CONSUMER_KEY = '' +CONSUMER_SECRET = '' +ACCESS_TOKEN_KEY = '' +ACCESS_TOKEN_SECRET = '' + +auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET) +auth.set_access_token(ACCESS_TOKEN_KEY, ACCESS_TOKEN_SECRET) +api = tweepy.API(auth) +argentinaFlag = u'\U0001F1E6' + u'\U0001F1F7' + +filenames = [] +for element in sys.argv[2:]: + filenames.append(element) + +media_ids = [] +for filename in filenames: + res = api.media_upload(filename) + media_ids.append(res.media_id) + +api.update_status(status=argentinaFlag + ' Imagen satelital: ' + sys.argv[1] + ' #NOAA #weather #argentinaimagenes #noaasatelllite #clima #wxtoimg #raspberrypi #argentina #argentinasat', media_ids=media_ids)