#
http://open.weibo.com/wiki/index.php/SDK
# 下载sinatpy解压放到py安装目录下的Libs就好用了
# 下载sinatpy解压放到py安装目录下的Libs就好用了
#
-*- coding:utf-8 -*-
import unittest
from weibopy.auth import OAuthHandler
from weibopy.api import API
import unittest
from weibopy.auth import OAuthHandler
from weibopy.api import API
## 你注册应用获取的key and secret
consumer_key = ' xxx '
consumer_secret = ' xxx '
consumer_key = ' xxx '
consumer_secret = ' xxx '
## url = auth.get_authorization_url() ## 获取pid码
## auth.get_access_token()
access_token = ' xxx '
access_token_secret = ' xxx '
def friends():
timeline = api.friends(count = 100 ,page = 3 )
for x in timeline:
uid = x. __getattribute__ ( " id " )
name = x. __getattribute__ ( " screen_name " )
print " friends " + str(uid) + " : " + name
def login(access_token,access_token_secret):
auth = OAuthHandler(consumer_key,consumer_secret)
auth.setToken(access_token,access_token_secret)
return API(auth)
api = login(access_token,access_token_secret)
friends()
access_token = ' xxx '
access_token_secret = ' xxx '
def friends():
timeline = api.friends(count = 100 ,page = 3 )
for x in timeline:
uid = x. __getattribute__ ( " id " )
name = x. __getattribute__ ( " screen_name " )
print " friends " + str(uid) + " : " + name
def login(access_token,access_token_secret):
auth = OAuthHandler(consumer_key,consumer_secret)
auth.setToken(access_token,access_token_secret)
return API(auth)
api = login(access_token,access_token_secret)
friends()