DEV Community

Discussion on: How to change Twitter Source Label

Collapse
 
sunilaleti profile image
Sunil Aleti • Edited

If you want to upload image or video in a tweet, use this

import tweepy
auth = tweepy.OAuthHandler("CONSUMER KEY HERE", "CONSUMER KEY SECRET HERE")
auth.set_access_token("ACCESS TOKEN HERE", "ACCESS TOKEN SECRET HERE")
api = tweepy.API(auth)
tweet = input("")
image="C:/Users/facadmin1/Downloads/introdev.PNG"  #Enter image location
api.update_with_media(image, tweet)
Enter fullscreen mode Exit fullscreen mode
Collapse
 
k_edgarr profile image
Edgar

where do i put the image path

Collapse
 
sunilaleti profile image
Sunil Aleti

In 5th line, inside input enter the image location

Thread Thread
 
k_edgarr profile image
Edgar

figured it out that im supposed to put to // on the path or else it will have an error

Collapse
 
nonvieri profile image
nonvieri

unicode error ‘unicodeescape’ codec can’t decode bytes etc

Collapse
 
kiprono profile image
Kiprono

@nonvieri I'm getting the same error too. @sunilaleti what's the solution here?

Some comments have been hidden by the post's author - find out more