Python 推送微博信息 v1.0

Python 发送微博

 1 #!/usr/bin/env python

 2 # -*- coding: utf-8 -*-

 3  

 4 from weibo import *

 5  

 6 def press_sina_weibo():

 7  

 8     APP_KEY = 'XXXX'

 9     APP_SECRET = 'XXXX'

10  

11     CALLBACK_URL = 'https://api.weibo.com/oauth2/default.html'

12     

13     client = APIClient(app_key=APP_KEY, app_secret=APP_SECRET, redirect_uri=CALLBACK_URL)

14     print client.get_authorize_url()

15     

16     r = client.request_access_token(raw_input("input code:").strip())

17     client.set_access_token(r.access_token, r.expires_in)

18     

19     print client.post.statuses__update(status=u'擦擦,Python 代码终于可以发送微博了')

20     

21 if __name__ == '__main__':

22     press_sina_weibo()

 

你可能感兴趣的:(python)