Last active
May 24, 2017 10:04
-
-
Save hitesh83/295031fcaf368d8dae47df01885d0647 to your computer and use it in GitHub Desktop.
Twython Picam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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