Twitter Messaging + Raspberry Pi

From ESE205 Wiki
Jump to navigation Jump to 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 --upgrade
  10. Connect to Twitter API using the keys, refer to Figure 12.1
  11. Save a picture onto Raspberry Pi
  12. 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"]
  13. To randomize the message that appears with the photo type: postmsg = choice(POST_MESSAGES)
  14. To post a picture type: t.update_status_with_media(status = POST_MESSAGES, media=photo)
Figure 12.1.