Writing an Android Twitter Client with Python
Learn:
- Access Twitter API
Requirements
- The example programs can be run from the emulator and smartphone.
- Point your smartphone or emulator browser to m.smartphonedaq.com to download and install the Tweepy API. Tweepy is Twitter library for python for accessing the Twitter.com API. Supports OAuth, covers the entire API, and streaming API. The Twitter API that comes with Py4A does not support Oauth. If you use RemoteControl, the Tweepy API must be installed on your PC.
Read the Timeline
Do try out the read twitter example first as it does not require authentication and can be run as is.
read_tweet.py
Send Tweet
You need to have a twitter account if you want to send twits. The send twit program requires authentication information and you must modify the example program before running. We are using the authentication method to access the API from your own account.
- Create a new application at dev.twitter.com. Go ahead and fill in the required fields (the website URL can be a placeholder). Set the application to read/write access.
- Get the access tokens - see dev.twitter.com/docs/auth/tokens-devtwittercom
- Modify the send_tweet.py with your tokens
send_tweet.py
Do observe the anti-spamming rules of twitter. It may prevent your status from being updated.
For more information on the teepy.api, please read the Tweepy API documentation.
Scan the script to your smartphone using the Test EMANT380 app or download to PC/Emulator