当前位置: 首页 > 工具软件 > sinatpy > 使用案例 >

*py_sinatpy

毕衡
2023-12-01
 
  
# http://open.weibo.com/wiki/index.php/SDK
#
下载sinatpy解压放到py安装目录下的Libs就好用了
 
    
# -*- coding:utf-8 -*-

import unittest
from weibopy.auth import OAuthHandler
from weibopy.api import API

## 你注册应用获取的key and secret
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()

转载于:https://www.cnblogs.com/eth0/archive/2011/06/28/2092528.html

 类似资料:

相关阅读

相关文章

相关问答