Difference between revisions of "How to install twitter code to Raspberry Pi"

From ESE205 Wiki
Jump to: navigation, search
 
Line 10: Line 10:
 
# Click upgrade
 
# Click upgrade
 
# Connect to Twitter API using the keys, refer to Figure 12.1
 
# Connect to Twitter API using the keys, refer to Figure 12.1
[[File:Twitter code.PNG|250px|thumb|left|Figure 12.1.]]
 
 
# Save a picture onto Raspberry Pi
 
# Save a picture onto Raspberry Pi
 
# 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"]
 
# 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"]
 
# To randomize the message that appears with the photo type: postmsg = choice(POST_MESSAGES)
 
# To randomize the message that appears with the photo type: postmsg = choice(POST_MESSAGES)
 
# 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.]]

Latest revision as of 15:48, 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.