Thursday, December 26, 2024
Google search engine
HomeLanguagesPython – API.configuration() in Tweepy

Python – API.configuration() 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.configuration()

The configuration() method of the API class in Tweepy module is used to fetch the current configuration used by Twitter.

Syntax : API.configuration()

Parameters : None

Returns : an object of class dict

Example :




# 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 configuration
configuration = api.configuration()
  
# printing the information
for key, value in configuration.items():
    print(key  + " : " + str(value), end = "\n\n")


Output :

dm_text_character_limit : 10000

characters_reserved_per_media : 24

max_media_per_upload : 1

non_username_paths : [‘about’, ‘account’, ‘accounts’, ‘activity’, ‘all’, ‘announcements’, ‘anywhere’, ‘api_rules’, ‘api_terms’, ‘apirules’, ‘apps’, ‘auth’, ‘badges’, ‘blog’, ‘business’, ‘buttons’, ‘contacts’, ‘devices’, ‘direct_messages’, ‘download’, ‘downloads’, ‘edit_announcements’, ‘faq’, ‘favorites’, ‘find_sources’, ‘find_users’, ‘followers’, ‘following’, ‘friend_request’, ‘friendrequest’, ‘friends’, ‘goodies’, ‘help’, ‘home’, ‘i’, ‘im_account’, ‘inbox’, ‘invitations’, ‘invite’, ‘jobs’, ‘list’, ‘login’, ‘logo’, ‘logout’, ‘me’, ‘mentions’, ‘messages’, ‘mockview’, ‘newtwitter’, ‘notifications’, ‘nudge’, ‘oauth’, ‘phoenix_search’, ‘positions’, ‘privacy’, ‘public_timeline’, ‘related_tweets’, ‘replies’, ‘retweeted_of_mine’, ‘retweets’, ‘retweets_by_others’, ‘rules’, ‘saved_searches’, ‘search’, ‘sent’, ‘sessions’, ‘settings’, ‘share’, ‘signup’, ‘signin’, ‘similar_to’, ‘statistics’, ‘terms’, ‘tos’, ‘translate’, ‘trends’, ‘tweetbutton’, ‘twttr’, ‘update_discoverability’, ‘users’, ‘welcome’, ‘who_to_follow’, ‘widgets’, ‘zendesk_auth’, ‘media_signup’]

photo_size_limit : 3145728

photo_sizes : {‘thumb’: {‘h’: 150, ‘resize’: ‘crop’, ‘w’: 150}, ‘small’: {‘h’: 480, ‘resize’: ‘fit’, ‘w’: 340}, ‘medium’: {‘h’: 1200, ‘resize’: ‘fit’, ‘w’: 600}, ‘large’: {‘h’: 2048, ‘resize’: ‘fit’, ‘w’: 1024}}

short_url_length : 23

short_url_length_https : 23

Last Updated :
11 Jun, 2020
Like Article
Save Article

<!–

–>

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

Most Popular

Recent Comments