Skip to main content

Posts

Showing posts from November, 2017

Extracting Data from Twitter using Twitter API (in Python/Pycharm)

Pre-Requisites for this task: User should have a Twitter Account. Phone number should be linked with Twitter Account. ( Ways to Add Phone number in twitter ) Pycharm should be installed. Add Plugin named Tweepy in Pycharm. Obtain Twitter API Key from Twitter. How To Obtain Twitter API key: Go to apps.twitter.com and log in with your Twitter account. Click 'Create a new app' and fill the details. Callback URL is not mandatory. The system will generate an API key and an API secret. Generate an access token on 'Keys and Access Tokens' tab. Four keys will be generated. What exactly to write in Pycharm: import tweepy consumer_key = 'CONSUMER-KEY-FROM-TWITTER' consumer_secret = 'CONSUMER-SECRET-FROM-TWITTER' access_token = 'ACCESS-TOKEN-FROM-TWITTER' access_secret = 'ACCESS-SECRET-FROM-TWITTER' authentication = tweepy.OAuthHandler(consumer_key,consumer_secret) authentication.set_access_token(access_token, access_sec