Difference between revisions of "Twitter Messaging + Raspberry Pi"

From ESE205 Wiki
Jump to: navigation, search
(Created page with "# Create a Twitter account # Go to apps.twitter.com/ and click create new app button # Complete application details form (Enter name, description, and publicly accessible webs...")
 
Line 15: Line 15:
 
# To post a picture type: t.update_status_with_media(status = POST_MESSAGES, media=photo)
 
# To post a picture type: t.update_status_with_media(status = POST_MESSAGES, media=photo)
 
[[File:Twitter code.PNG|500px|thumb|right|Figure 12.1.]]
 
[[File:Twitter code.PNG|500px|thumb|right|Figure 12.1.]]
 +
 +
 +
[[Category:HowTos]]

Revision as of 15:51, 2 May 2017

  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.