{"componentChunkName":"component---src-pages-author-author-yaml-id-js","path":"/author/sameer-mahajan/","result":{"data":{"allMarkdownRemark":{"edges":[{"node":{"id":"cc7e7d30-fceb-5d64-afa5-a9da979d7ce5","html":"<p>As we all know, Twitter is one of the most preferred microblogging websites when it comes to putting your thoughts on the internet. Big organizations use this platform for advertising their product; government institutions even use it to provide prompt customer resolution; various groups use Twitter to run social awareness campaigns and media campaigns. Twitter has close to 330 million monthly active users worldwide, out of which 17 million hits are generated from India itself along with more than 1 billion downloads on Play Store. With all this in mind, Twitter allows access to Twitter API to developers to create some cool applications like bots, automation tools, etc. This Twitter API gives developers access to almost all of Twitter's functionalities like likes, retweets, tweets, etc. Tweepy, a python package, helps us in achieving all this.</p>\n<p>Tweepy is a python package that smoothly and transparently accesses Twitter's endpoints made available for the developers. Without Tweepy, the user would have to take care of various low-level details about HTTP requests, rate limiting, authentication, serialization, etc. Tweepy handles all this mess on behalf of the user making the application prone to errors.\nIn simple words, Tweepy is an open-source python package that provides a way for developers to communicate with the Twitter API. But keep in mind that Twitter levies a rate limit on the number of requests made to the Twitter API. To be precise, 900 requests/15 minutes are allowed; Twitter feeds anything above that an error.</p>\n<h3 id=\"installation\" style=\"position:relative;\"><a href=\"#installation\" aria-label=\"installation permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Installation</h3>\n<p>Tweepy can be installed by using Python package manager <strong>pip</strong>. A simple demonstration can be seen below:\n<img src=\"/40dde8efec2ad55ac4676067a47623cc/installation.png\" alt=\"installation\" title=\"Installation\"></p>\n<p>Installation on Linux and macOS should follow similar steps as well.</p>\n<p>Twitter API uses OAuth for authentication, so initially, you need to apply for authentication credentials from Twitter. These authentication credentials basically consists of 4 components namely : <em>consumer</em>key, consumer<em>secret</em>key, access<em>token, access</em>token<em>secret</em> . These credentials from Twitter are used to instantiate the API. <strong>Each account gets a unique key, so don't reuse someone else's keys.</strong>\nFor getting those credentials from Twitter, apply for a developer account on the <a href=\"https://developer.twitter.com/en\">Twitter Developers</a> page.\n<img src=\"/5c15dfefc6853d899b15baf7a91ab241/twitterdev.png\" alt=\"twitterdev\" title=\"Twitter Dev Dashboard\">\nThis is what the account looks like. Here you will get detailed information about the total no. of requests made, your API credentials, and much more information. After creating an account, you need to create an app wherein you will be asked to name your app and a short description. You must be wondering what an app is?\nThe app is like a gateway that contains a set of permissions and keys used to access the Twitter API. An app is needed for accessing the Twitter API as a part of Twitter's OAuth authentication. After creating an app, generate new authentication tokens for authorization purposes.</p>\n<p><img src=\"/3e1ad6c1ae5d8e5ab84b112068ba87f1/keys.png\" alt=\"keys\"></p>\n<h3 id=\"getting-started-tweepy\" style=\"position:relative;\"><a href=\"#getting-started-tweepy\" aria-label=\"getting started tweepy permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Getting Started: Tweepy</h3>\n<p>There are four common basic steps in any Tweepy application.</p>\n<ol>\n<li>Importing tweepy package.</li>\n<li>Setting the authentication credentials.</li>\n<li>Instantiating the API.</li>\n<li>Creating API object.</li>\n</ol>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"0\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> tweepy</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\"># authenticating twitter api credentials</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">consumer_key = </span><span class=\"mtk8\">&#39;2OsNoPKOYCpxxxxxxxxxxxxxxxxxxxxxx&#39;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">consumer_secret = </span><span class=\"mtk8\">&#39;Xw07uU51xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#39;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">access_token = </span><span class=\"mtk8\">&#39;24621057xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx&#39;</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">access_token_secret = </span><span class=\"mtk8\">&#39;pXt5xxxxxxxxxxxxxxxxxxxxxxxxxxxx&#39;</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\"># instantiating the api</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">auth = tweepy.OAuthHandler(consumer_key, consumer_secret)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">auth.set_access_token(access_token, access_token_secret)</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk3\"># creating API object</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">api = tweepy.API(auth,</span><span class=\"mtk12\">wait_on_rate_limit</span><span class=\"mtk1\">=</span><span class=\"mtk4\">True</span><span class=\"mtk1\">,</span><span class=\"mtk12\">wait_on_rate_limit_notify</span><span class=\"mtk1\">=</span><span class=\"mtk4\">True</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">import</span><span class=\"mtk1\"> tabulate</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">user = api.get_user(</span><span class=\"mtk8\">&quot;Cristiano&quot;</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk11\">print</span><span class=\"mtk1\">(</span><span class=\"mtk8\">&quot;User Details:&quot;</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk11\">print</span><span class=\"mtk1\">(tabulate([[</span><span class=\"mtk8\">&quot;Name&quot;</span><span class=\"mtk1\">,</span><span class=\"mtk8\">&quot;Description&quot;</span><span class=\"mtk1\">,</span><span class=\"mtk8\">&quot;Location&quot;</span><span class=\"mtk1\">],[user.name,user.description,user.location]],</span><span class=\"mtk12\">headers</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;firstrow&quot;</span><span class=\"mtk1\">))</span></span></code></pre>\n<blockquote>\n<p>Note: Use your credentials in the hidden keys above._</p>\n</blockquote>\n<p>Objects created from the Tweepy. API class helps us access most of Twitter's available functionality like tweets, retweets, likes, etc. In the code snippet, we used the api.get_user method for getting information about a certain user on Twitter. Likewise, there can be several use cases of different methods(discussed below) made available by Twitter to developers. You can find the link for this code <a href=\"https://colab.research.google.com/drive/1dN02ioXElOQPOktIzNBACCncyrI2eiBR?usp=sharing\">here.</a></p>\n<p>Now we will see different methods provided by Twitter. The API methods have been divided into groups based on their functionality. The detailed guide for the API methods can be found at the official <a href=\"https://tweepy.readthedocs.io/en/latest/api.html\">API Reference</a> documentation. </p>\n<ul>\n<li>Timeline methods</li>\n<li>Status methods</li>\n<li>User methods</li>\n<li>Direct Message Methods</li>\n<li>Friendship Methods</li>\n<li>Favorite Methods</li>\n<li>Block Methods</li>\n<li>Search Methods</li>\n<li>Trends Methods</li>\n<li>Geo Methods</li>\n</ul>\n<h4 id=\"timeline-methods\" style=\"position:relative;\"><a href=\"#timeline-methods\" aria-label=\"timeline methods permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Timeline Methods</h4>\n<p>These methods handles the tweets, retweets, statuses on your/someone else's timeline as long as the account is public.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"1\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">tweets = api.home_timeline()</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk15\">for</span><span class=\"mtk1\"> tweet </span><span class=\"mtk4\">in</span><span class=\"mtk1\"> tweets:</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk11\">print</span><span class=\"mtk1\">(</span><span class=\"mtk4\">f</span><span class=\"mtk8\">&quot;</span><span class=\"mtk4\">{</span><span class=\"mtk1\">tweet.user.name</span><span class=\"mtk4\">}</span><span class=\"mtk8\"> said </span><span class=\"mtk4\">{</span><span class=\"mtk1\">tweet.text</span><span class=\"mtk4\">}</span><span class=\"mtk8\">&quot;</span><span class=\"mtk1\">)</span></span></code></pre>\n<p>api.home_timeline() is an API method that returns the 20 most recent tweets on the user's timeline.</p>\n<h4 id=\"status-methods\" style=\"position:relative;\"><a href=\"#status-methods\" aria-label=\"status methods permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Status Methods</h4>\n<p>These methods deal with creating, fetching tweets, retweeting tweets.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"2\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">api.update_status(</span><span class=\"mtk8\">&quot;Hello World!&quot;</span><span class=\"mtk1\">)</span></span></code></pre>\n<p>api.update_status() is an API method used to create a tweet on the user's timeline. For each update request, it will check the user's recent tweets. If any duplication is found, the request will be blocked by Twitter as a user cannot post the same tweet more than once.</p>\n<h4 id=\"user-methods\" style=\"position:relative;\"><a href=\"#user-methods\" aria-label=\"user methods permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>User Methods</h4>\n<p>These methods help to find the user details using various paramaeter like name, location, description,friends, followers,etc. as long as the account is public. </p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"3\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">user = api.get_user(</span><span class=\"mtk8\">&quot;ISRO&quot;</span><span class=\"mtk1\">)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk11\">print</span><span class=\"mtk1\">(user.name)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk11\">print</span><span class=\"mtk1\">(user.decscription)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk11\">print</span><span class=\"mtk1\">(user.followers)</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk11\">print</span><span class=\"mtk1\">(user.location)</span></span></code></pre>\n<p>We have used get_user() previously to fetch user details of specific accounts.</p>\n<h4 id=\"friendship-methods\" style=\"position:relative;\"><a href=\"#friendship-methods\" aria-label=\"friendship methods permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Friendship Methods</h4>\n<p>These methods help the user to follow, unfollow certain accounts, list the accounts user follows, etc.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"4\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">api.create_friendship(</span><span class=\"mtk8\">&quot;elonmusk&quot;</span><span class=\"mtk1\">)</span></span></code></pre>\n<p>create_friendship() will add @elonmusk to the list of accounts you follow.</p>\n<h4 id=\"favorite-methods\" style=\"position:relative;\"><a href=\"#favorite-methods\" aria-label=\"favorite methods permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Favorite Methods</h4>\n<p>Likes or unlikes(if already liked) the status specified in the ID parameter as the authenticating user.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"5\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">api.create_favorite(tweet.id)</span></span></code></pre>\n<p>create_favorite() will like a tweet based on the tweet id provided.</p>\n<h4 id=\"block-methods\" style=\"position:relative;\"><a href=\"#block-methods\" aria-label=\"block methods permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Block Methods</h4>\n<p>Used to block, unblock, list blocked accounts of the user.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"6\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">api.create_block(</span><span class=\"mtk11\">id</span><span class=\"mtk1\">/screen_name)</span></span></code></pre>\n<p>create<em>block() will block the specific user using the id/screen</em>name provided. </p>\n<h4 id=\"search-methods\" style=\"position:relative;\"><a href=\"#search-methods\" aria-label=\"search methods permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Search Methods</h4>\n<p>These methods help the user to search specific tweet based upon the search query and parameters provided. But not all tweets will be indexed or made available through the search methods.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"7\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk15\">for</span><span class=\"mtk1\"> tweets </span><span class=\"mtk4\">in</span><span class=\"mtk1\"> api.search(</span><span class=\"mtk12\">q</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;iphone&quot;</span><span class=\"mtk1\">, </span><span class=\"mtk12\">lang</span><span class=\"mtk1\">=</span><span class=\"mtk8\">&quot;en&quot;</span><span class=\"mtk1\">):</span></span>\n<span class=\"grvsc-line\"><span class=\"mtk1\">    </span><span class=\"mtk11\">print</span><span class=\"mtk1\">(tweet.text)</span></span></code></pre>\n<p>search() will look out for all the tweets available for the query keyword 'q' provided.</p>\n<h4 id=\"trends-methods\" style=\"position:relative;\"><a href=\"#trends-methods\" aria-label=\"trends methods permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Trends Methods</h4>\n<p>It returns the trends going on at a specific geographical location.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"8\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">api.trends_place(</span><span class=\"mtk7\">1</span><span class=\"mtk1\">)</span></span></code></pre>\n<p>trends_place() will show trends in the specific area. Here one stands for worldwide.</p>\n<h4 id=\"geo-methods\" style=\"position:relative;\"><a href=\"#geo-methods\" aria-label=\"geo methods permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Geo Methods</h4>\n<p>It returns the geographical location like latitude, the longitude of the place id provided.</p>\n<pre class=\"grvsc-container dark-default-dark\" data-language=\"python\" data-index=\"9\"><code class=\"grvsc-code\"><span class=\"grvsc-line\"><span class=\"mtk1\">api.geo_id(</span><span class=\"mtk11\">id</span><span class=\"mtk1\">)</span></span></code></pre>\n<p>geo_id() returns more geographical information of the concerned place id.</p>\n<h3 id=\"conclusion\" style=\"position:relative;\"><a href=\"#conclusion\" aria-label=\"conclusion permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Conclusion</h3>\n<p>Tweepy allows the user to concentrate on the application's logic by hiding many low-level details, thus making the application bug-free. You can use tweepy to do some cool projects like bots, automation, machine learning applications, etc. </p>\n<h5 id=\"ket-takeaways\" style=\"position:relative;\"><a href=\"#ket-takeaways\" aria-label=\"ket takeaways permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Ket Takeaways</h5>\n<ul>\n<li>What is Tweepy?</li>\n<li>Installation</li>\n<li>Getting Started with Tweepy</li>\n<li>Various API methods</li>\n</ul>\n<p>More information about tweepy can be found at <a href=\"https://tweepy.readthedocs.io/en/latest/index.html\">docs.</a> Make sure to look at the official documentation as it will provide you with a greater picture of the package. So what are you waiting for? Go ahead, use your imagination, and get started with the side-project you've always been thinking of.</p>\n<style class=\"grvsc-styles\">\n  .grvsc-container {\n    overflow: auto;\n    -webkit-overflow-scrolling: touch;\n    padding-top: 1rem;\n    padding-top: var(--grvsc-padding-top, var(--grvsc-padding-v, 1rem));\n    padding-bottom: 1rem;\n    padding-bottom: var(--grvsc-padding-bottom, var(--grvsc-padding-v, 1rem));\n    border-radius: 8px;\n    border-radius: var(--grvsc-border-radius, 8px);\n    font-feature-settings: normal;\n  }\n  \n  .grvsc-code {\n    display: inline-block;\n    min-width: 100%;\n  }\n  \n  .grvsc-line {\n    display: inline-block;\n    box-sizing: border-box;\n    width: 100%;\n    padding-left: 1.5rem;\n    padding-left: var(--grvsc-padding-left, var(--grvsc-padding-h, 1.5rem));\n    padding-right: 1.5rem;\n    padding-right: var(--grvsc-padding-right, var(--grvsc-padding-h, 1.5rem));\n  }\n  \n  .grvsc-line-highlighted {\n    background-color: var(--grvsc-line-highlighted-background-color, transparent);\n    box-shadow: inset var(--grvsc-line-highlighted-border-width, 4px) 0 0 0 var(--grvsc-line-highlighted-border-color, transparent);\n  }\n  \n  .dark-default-dark {\n    background-color: #1E1E1E;\n    color: #D4D4D4;\n  }\n  .dark-default-dark .mtk15 { color: #C586C0; }\n  .dark-default-dark .mtk1 { color: #D4D4D4; }\n  .dark-default-dark .mtk3 { color: #6A9955; }\n  .dark-default-dark .mtk8 { color: #CE9178; }\n  .dark-default-dark .mtk12 { color: #9CDCFE; }\n  .dark-default-dark .mtk4 { color: #569CD6; }\n  .dark-default-dark .mtk11 { color: #DCDCAA; }\n  .dark-default-dark .mtk7 { color: #B5CEA8; }\n</style>","frontmatter":{"title":"Beginners Guide to Tweepy ","author":{"id":"Sameer Mahajan","github":"sameermahajan101","avatar":null},"date":"November 02, 2020","updated_date":null,"tags":["Twitter","Tweepy","Python"],"coverImage":{"childImageSharp":{"fluid":{"aspectRatio":1.5037593984962405,"src":"/static/63d4d3ea1070111c43e0bdfa476b2a62/14b42/coverimage.jpg","srcSet":"/static/63d4d3ea1070111c43e0bdfa476b2a62/f836f/coverimage.jpg 200w,\n/static/63d4d3ea1070111c43e0bdfa476b2a62/2244e/coverimage.jpg 400w,\n/static/63d4d3ea1070111c43e0bdfa476b2a62/14b42/coverimage.jpg 800w,\n/static/63d4d3ea1070111c43e0bdfa476b2a62/47498/coverimage.jpg 1200w,\n/static/63d4d3ea1070111c43e0bdfa476b2a62/0e329/coverimage.jpg 1600w,\n/static/63d4d3ea1070111c43e0bdfa476b2a62/d8255/coverimage.jpg 1920w","sizes":"(max-width: 800px) 100vw, 800px"}}}},"fields":{"authorId":"Sameer Mahajan","slug":"/engineering/beginners-guide-to-tweepy/"}}}]},"authorYaml":{"id":"Sameer Mahajan","bio":"Recent Computer Science Graduate","github":"sameermahajan101","stackoverflow":"11896352","linkedin":"sameer-mahajan-777105127","medium":null,"twitter":"sameermahan101","avatar":null}},"pageContext":{"id":"Sameer Mahajan","__params":{"id":"sameer-mahajan"}}},"staticQueryHashes":["1171199041","1384082988","2100481360","23180105","528864852"]}