You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

post.py 717 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env python2
  2. import sys
  3. import tweepy
  4. CONSUMER_KEY = ''
  5. CONSUMER_SECRET = ''
  6. ACCESS_TOKEN_KEY = ''
  7. ACCESS_TOKEN_SECRET = ''
  8. auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)
  9. auth.set_access_token(ACCESS_TOKEN_KEY, ACCESS_TOKEN_SECRET)
  10. api = tweepy.API(auth)
  11. argentinaFlag = u'\U0001F1E6' + u'\U0001F1F7'
  12. filenames = []
  13. for element in sys.argv[2:]:
  14. filenames.append(element)
  15. media_ids = []
  16. for filename in filenames:
  17. res = api.media_upload(filename)
  18. media_ids.append(res.media_id)
  19. api.update_status(status=argentinaFlag + ' Imagen satelital: ' + sys.argv[1] + ' #NOAA #weather #argentinaimagenes #noaasatelllite #clima #wxtoimg #raspberrypi #argentina #argentinasat', media_ids=media_ids)