Skip to content

Instantly share code, notes, and snippets.

@hitesh83
Last active May 24, 2017 10:04
Show Gist options
  • Save hitesh83/295031fcaf368d8dae47df01885d0647 to your computer and use it in GitHub Desktop.
Save hitesh83/295031fcaf368d8dae47df01885d0647 to your computer and use it in GitHub Desktop.
Twython Picam
#!/usr/bin/env python
import sys
import os
from twython import Twython
consumer_key = 'INSERT YOUR KEY HERE'
consumer_secret = 'INSERT YOUR KEY HERE'
access_token = 'INSERT YOUR KEY HERE'
access_token_secret = 'INSERT YOUR KEY HERE'
takephoto = "raspistill -w 1024 -h 768 -o /home/pi/picam/cam.jpg"
twitter = Twython(consumer_key, consumer_secret, access_token, access_token_secret)
os.system(takephoto)
cmd = '/opt/vc/bin/vcgencmd measure_temp'
line = os.popen(cmd).readline().strip()
temp = line.split('=')[1].split("'")[0]
photo=open('/home/pi/picam/cam.jpg','rb')
twitter.update_status_with_media(media=photo, status='My RPi CPU Temperature is '+temp+'C and Photo from RPi Camera--> ')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment