Created
August 30, 2013 03:39
-
-
Save wittyfilter/6386111 to your computer and use it in GitHub Desktop.
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/python | |
import webbrowser | |
import os | |
import string | |
import time | |
from weibo import * | |
def press_sina_weibo(): | |
APP_KEY = '- - - - - - - - - -' #your app key | |
APP_SECRET = '- - - - - - - - ' # your app secret | |
CALLBACK_URL = '- - - - - - - -' #your CALLBACK_URL | |
client = APIClient(app_key=APP_KEY, app_secret=APP_SECRET, redirect_uri=CALLBACK_URL) | |
print client.get_authorize_url() | |
r = client.request_access_token(raw_input("input code:").strip()) | |
client.set_access_token(r.access_token, r.expires_in) | |
tboard = raw_input('Enter the tempreture limited>') | |
tlimit = string.atof(tboard) | |
text2 = 'warning!!the tem is ' | |
a = 1 | |
while True: | |
p = os.popen('sudo ./sensor','r') | |
line = p.readline(); | |
tnow = string.atof(line) | |
if tnow > tlimit: | |
line = text2+line | |
if a%2==0: | |
line += '!!' | |
line += '\n' | |
utext = unicode(line,"UTF-8") | |
client.post.statuses__update(status=utext) | |
a = a+1 | |
time.sleep(2) | |
if __name__ == '__main__': | |
press_sina_weibo() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment