您的位置:首页 > 编程语言 > Python开发

curl & python 更新新浪微博

2010-10-12 20:04 281 查看
利用curl 登录、更新新浪微博,用python包装为一个函数了。

def main(user, pwd, message):
try:
cmd = 'curl -k -c sina.txt "https://login.sina.com.cn/sso/login.php?username=%s&password=%s&returntype=TEXT"' % (user, pwd)

os.system( cmd)
cmd = 'curl -e "http://t.sina.com.cn/" -b sina.txt -d "content=%s" "http://t.sina.com.cn/mblog/publish.php" ' % message
os.system(cmd)
os.system('rm sina.txt')
print '\nsend msg ok\n'
except Exception, e:
print e


整理自:http://isouth.org/archives/277.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: