Friday, September 26, 2025
HomeLanguagesPython – API.mutes() in Tweepy

Python – API.mutes() in Tweepy

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.mutes()

The mutes() method of the API class in Tweepy module is used to get a list of all the users muted by the authenticated user.

Syntax : API.mutes()

Parameters : None

Returns : a list of objects of class User

Example 1 : Finding the number of users muted by the authenticated user using the mutes() method.




# import the module
import tweepy
  
# assign the values accordingly
consumer_key = ""
consumer_secret = ""
access_token = ""
access_token_secret = ""
  
# authorization of consumer key and consumer secret
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
  
# set access to user's access key and access secret 
auth.set_access_token(access_token, access_token_secret)
  
# calling the api 
api = tweepy.API(auth)
  
# getting the muted users
muted_users = api.mutes()
  
# printing the number of muuted users
print(len(muted_users))


Output :

2

Example 2 : Finding the screen names of all users muted by the authenticated user using the mutes() method.




# getting the blocked users
muted_users = api.mutes()
  
# printing the screen names of the muted users
for user in muted_users:
    print(user.screen_name)


Output :

PracticeGfG
JohnOberg
Last Updated :
08 Jun, 2020
Like Article
Save Article

<!–

–>

Similar Reads
Related Tutorials
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32320 POSTS0 COMMENTS
Milvus
84 POSTS0 COMMENTS
Nango Kala
6683 POSTS0 COMMENTS
Nicole Veronica
11854 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11910 POSTS0 COMMENTS
Shaida Kate Naidoo
6795 POSTS0 COMMENTS
Ted Musemwa
7071 POSTS0 COMMENTS
Thapelo Manthata
6755 POSTS0 COMMENTS
Umr Jansen
6762 POSTS0 COMMENTS