Skip to content

Instantly share code, notes, and snippets.

@szolotykh
Last active August 29, 2015 14:01
Show Gist options
  • Save szolotykh/715347c7e50c84b54090 to your computer and use it in GitHub Desktop.
Save szolotykh/715347c7e50c84b54090 to your computer and use it in GitHub Desktop.
Python script is update status on twitter
import tweepy
import os
# Consumer keys and access tokens, used for OAuth
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
# OAuth process, using the keys and tokens
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
# Creation of the actual interface, using authentication
api = tweepy.API(auth)
# Creates the user object
user = api.me()
print('Name: ' + user.name)
print('Location: ' + user.location)
print('Friends: ' + str(user.friends_count))
# Update status
# api.update_status('Hello Form RBI Lab!')
# load image
imagePath = "path\img.jpg"
status = "Hello! From Python script"
# Update status with imsge
api.update_with_media(imagePath, status)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment