How to install twitter code to Raspberry Pi

From ESE205 Wiki
Revision as of 15:48, 2 May 2017 by Mpichardo (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
  1. Create a Twitter account
  2. Go to apps.twitter.com/ and click create new app button
  3. Complete application details form (Enter name, description, and publicly accessible website)
  4. Modify your app permissions from read only to read and write
  5. Click the "keys" and "access tokens" tab
  6. Create an "access token"
  7. Refresh page and copy each of your "access tokens" (Consumer Key, Consumer Secret, Access Token, Access Token Secret)
  8. Make sure your date and time are correct using the raspberry Pi configuration tool
  9. Open Terminal and Download Twython type: sudo apt-get install Twython
  10. Click upgrade
  11. Connect to Twitter API using the keys, refer to Figure 12.1
  12. Save a picture onto Raspberry Pi
  13. If you want a message in your picture type: POST_MESSAGES = [ "Peek-A-Thief is awesome" , "I am a WashU engineer" , "I am not in the artsci department"]
  14. To randomize the message that appears with the photo type: postmsg = choice(POST_MESSAGES)
  15. To post a picture type: t.update_status_with_media(status = POST_MESSAGES, media=photo)
Figure 12.1.