Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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
You can’t perform that action at this time.