The Twitter API

The Twitter API provides access to all the functions that we may want a Twitter client to perform. With the Twitter API, we can create clients that search for recent Tweets, find out what's trending, look up user details, follow users' timelines, and even act on behalf of users by posting tweets and sending direct messages for them.

The Twitter module is based on the Twitter REST API located at https://developer.twitter.com/en/docs/tweets/search/api-reference.html.

You can install it with the  pip install twitter command:

Collecting twitter
Downloading https://files.pythonhosted.org/packages/85/e2/f602e3f584503f03e0389491b251464f8ecfe2596ac86e6b9068fe7419d3/twitter-1.18.0-py2.py3-none-any.whl (54kB)
100% |████████████████████████████████| 61kB 655kB/s
Installing collected packages: twitter
Successfully installed twitter-1.18.0

Now we can import the twitter module and show information about it with the help function:

>>> import twitter
>>> help(twitter)

This gives us the following output:

Also, we can see some examples of using the API:

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset