Python – API.update_profile() in Tweepy
Last Updated :
10 Jun, 2020
Twitter is a popular social network where users share messages called tweets. Twitter allows us to mine the data of any user using Twitter API or Tweepy. The data will be tweets extracted from the user. The first thing to do is get the consumer key, consumer secret, access key and access secret from twitter developer available easily for each user. These keys will help the API for authentication.
API.update_profile()
The update_profile()
method of the API
class in Tweepy module is used to update the profile of the authenticated user.
Syntax : API.update_profile(filename)
Parameter :
- name : name of the profile, maximum 20 characters.
- url : link of the url, maximum 100 characters.
- location : location of the user, maximum 30 characters.
- description : profile description, maximum 10 characters.
Returns : an object of class User
Example 1 : Update the name of the profile.
import tweepy
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
name = "Geeky Yash"
api.update_profile(name)
|
Output :
Example 2 : Updating the location of the profile.
location = "India"
api.update_profile(location = location)
|
Output :
Share your thoughts in the comments
Please Login to comment...