当前位置: 首页>>代码示例>>Python>>正文


Python BasicAuthHandler.setAccessToken方法代码示例

本文整理汇总了Python中weibopy.auth.BasicAuthHandler.setAccessToken方法的典型用法代码示例。如果您正苦于以下问题:Python BasicAuthHandler.setAccessToken方法的具体用法?Python BasicAuthHandler.setAccessToken怎么用?Python BasicAuthHandler.setAccessToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在weibopy.auth.BasicAuthHandler的用法示例。


在下文中一共展示了BasicAuthHandler.setAccessToken方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: Test

# 需要导入模块: from weibopy.auth import BasicAuthHandler [as 别名]
# 或者: from weibopy.auth.BasicAuthHandler import setAccessToken [as 别名]
class Test(unittest.TestCase):
    
    consumer_key=''
    consumer_secret=''
    
    def __init__(self):
            """ constructor """
    
    def getAtt(self, key):
        try:
            return self.obj.__getattribute__(key)
        except Exception as e:
            print(e)
            return ''
    
    def setAccessToken(self, key, secret):
        self.auth = OAuthHandler(self.consumer_key, self.consumer_secret)
        self.auth.setAccessToken(key, secret)
        self.api = API(self.auth)
        
    def basicAuth(self, source, username, password):
        self.auth = BasicAuthHandler(username, password)
        self.api = API(self.auth,source=source)
        
    def mentions(self):
        comments = self.api.mentions()
        for comment in comments:
            self.obj = comment
            mid = self.getAtt("id")
            text = self.getAtt("text")
            print("mentions---"+ str(mid) +":"+ text)
开发者ID:chengjun,项目名称:Research,代码行数:33,代码来源:mention.py

示例2: Test

# 需要导入模块: from weibopy.auth import BasicAuthHandler [as 别名]
# 或者: from weibopy.auth.BasicAuthHandler import setAccessToken [as 别名]
class Test(unittest.TestCase):
    
    consumer_key=''
    consumer_secret=''
    
    def __init__(self):
            """ constructor """
    
    def getAtt(self, key):
        try:
            return self.obj.__getattribute__(key)
        except Exception as e:
            print(e)
            return ''
    
    def setAccessToken(self, key, secret):
        self.auth = OAuthHandler(self.consumer_key, self.consumer_secret)
        self.auth.setAccessToken(key, secret)
        self.api = API(self.auth, source=self.consumer_key)
        
    def basicAuth(self, source, username, password):
        self.authType = 'basicauth'
        self.auth = BasicAuthHandler(username, password)
        self.api = API(self.auth,source=source)
    def get_privacy(self):
        privacy = self.api.get_privacy()
        self.obj = privacy
        ct = self.getAtt("comment")
        dm = self.getAtt("dm")
        real_name = self.getAtt("real_name")
        geo = self.getAtt("geo")
        badge = self.getAtt("badge") 
        print ("privacy---"+ str(ct) + str(dm) + str(real_name) + str(geo) + str(badge))
    def update_privacy(self):
        update_privacy = self.api.update_privacy(comment=0)        
开发者ID:chengjun,项目名称:Research,代码行数:37,代码来源:privacy.py

示例3: Test

# 需要导入模块: from weibopy.auth import BasicAuthHandler [as 别名]
# 或者: from weibopy.auth.BasicAuthHandler import setAccessToken [as 别名]
class Test(unittest.TestCase):
    
    consumer_key=''
    consumer_secret=''
    
    def __init__(self):
            """ constructor """
    
    def getAtt(self, key):
        try:
            return self.obj.__getattribute__(key)
        except Exception as e:
            print(e)
            return ''
    
    def setAccessToken(self, key, secret):
        self.auth = OAuthHandler(self.consumer_key, self.consumer_secret)
        self.auth.setAccessToken(key, secret)
        self.api = API(self.auth)
        
    def basicAuth(self, source, username, password):
        self.auth = BasicAuthHandler(username, password)
        self.api = API(self.auth,source=source)
        
    def unread(self):
        count = self.api.unread()
        self.obj = count
        mentions = self.getAtt("mentions")
        comments = self.getAtt("comments")
        followers = self.getAtt("followers")
        dm = self.getAtt("dm")
        print("mentions---"+ str(mentions) +":"+ str(comments) +":"+ str(followers) +":"+ str(dm))
开发者ID:chengjun,项目名称:Research,代码行数:34,代码来源:unread.py

示例4: Test

# 需要导入模块: from weibopy.auth import BasicAuthHandler [as 别名]
# 或者: from weibopy.auth.BasicAuthHandler import setAccessToken [as 别名]
class Test(unittest.TestCase):
    
    consumer_key=''
    consumer_secret=''
    
    def __init__(self):
            """ constructor """
    
    def getAtt(self, key):
        try:
            return self.obj.__getattribute__(key)
        except Exception as e:
            print(e)
            return ''
    
    def setAccessToken(self, key, secret):
        self.auth = OAuthHandler(self.consumer_key, self.consumer_secret)
        self.auth.setAccessToken(key, secret)
        self.api = API(self.auth, source=self.consumer_key)
        
    def basicAuth(self, source, username, password):
        self.auth = BasicAuthHandler(username, password)
        self.api = API(self.auth,source=source)
    
    def upload(self, filename, message):
        status = self.api.upload(filename, status=message)        
        self.obj = status
        id = self.getAtt("id")
        text = self.getAtt("text")
        self.obj = self.getAtt("user")
        profile_image_url  = self.getAtt("profile_image_url")
        print("upload,id="+ str(id) +",text="+ text +",profile_image_url="+ profile_image_url)
开发者ID:chengjun,项目名称:Research,代码行数:34,代码来源:upload.py

示例5: test

# 需要导入模块: from weibopy.auth import BasicAuthHandler [as 别名]
# 或者: from weibopy.auth.BasicAuthHandler import setAccessToken [as 别名]
class test(unittest.TestCase):
    
    consumer_key=''
    consumer_secret=''
    
    def __init__(self):
            """ constructor """
    
    def getAtt(self, key):
        try:
            return self.obj.__getattribute__(key)
        except Exception as e:
            print(e)
            return ''
    
    def setAccessToken(self, key, secret):
        self.auth = OAuthHandler(self.consumer_key, self.consumer_secret)
        self.auth.setAccessToken(key, secret)
        self.api = API(self.auth)
        
    def basicAuth(self, source, username, password):
        self.auth = BasicAuthHandler(username, password)
        self.api = API(self.auth,source=source)
        
    def friends(self):
        timeline = self.api.friends()
        for line in timeline:
            self.obj = line
            fid = self.getAtt("id")
            name = self.getAtt("screen_name")
            print("friends---"+ str(fid) +":"+ name)
开发者ID:chengjun,项目名称:Research,代码行数:33,代码来源:getFriends.py

示例6: Test

# 需要导入模块: from weibopy.auth import BasicAuthHandler [as 别名]
# 或者: from weibopy.auth.BasicAuthHandler import setAccessToken [as 别名]
class Test(unittest.TestCase):

    consumer_key = ""
    consumer_secret = ""

    def __init__(self):
        """ constructor """

    def getAtt(self, key):
        try:
            return self.obj.__getattribute__(key)
        except Exception as e:
            print(e)
            return ""

    def setAccessToken(self, key, secret):
        self.auth = OAuthHandler(self.consumer_key, self.consumer_secret)
        self.auth.setAccessToken(key, secret)
        self.api = API(self.auth, source=self.consumer_key)

    def basicAuth(self, source, username, password):
        self.authType = "basicauth"
        self.auth = BasicAuthHandler(username, password)
        self.api = API(self.auth, source=source)

    def counts(self):
        counts = self.api.counts(ids="1864372538,1484854960,1877120192")
        for count in counts:
            self.obj = count
            mid = self.getAtt("id")
            comments = self.getAtt("comments")
            rt = self.getAtt("rt")
            print("mentions---" + str(mid) + ":" + str(comments) + ":" + str(rt))
开发者ID:rahulsoni9,项目名称:Research,代码行数:35,代码来源:counts.py

示例7: Test

# 需要导入模块: from weibopy.auth import BasicAuthHandler [as 别名]
# 或者: from weibopy.auth.BasicAuthHandler import setAccessToken [as 别名]
class Test(unittest.TestCase):
    
    consumer_key=''
    consumer_secret=''
    
    def __init__(self):
            """ constructor """
    
    def getAtt(self, key):
        try:
            return self.obj.__getattribute__(key)
        except Exception as e:
            print(e)
            return ''
    
    def setAccessToken(self, key, secret):
        self.auth = OAuthHandler(self.consumer_key, self.consumer_secret)
        self.auth.setAccessToken(key, secret)
        self.api = API(self.auth)
        
    def basicAuth(self, source, username, password):
        self.auth = BasicAuthHandler(username, password)
        self.api = API(self.auth,source=source)
        
    def friends_timeline(self):
        timeline = self.api.friends_timeline(count=2, page=1)
        for line in timeline:
            self.obj = line
            mid = self.getAtt("id")
            text = self.getAtt("text")
            print("friends_timeline---"+ str(mid) +":"+ text)

    def comments_timeline(self):
        timeline = self.api.comments_timeline(count=2, page=1)
        for line in timeline:
            self.obj = line
            mid = self.getAtt("id")
            text = self.getAtt("text")
            print("comments_timeline---"+ str(mid) +":"+ text)
            
    def user_timeline(self):
        timeline = self.api.user_timeline(count=5, page=1)
        for line in timeline:
            self.obj = line
            mid = self.getAtt("id")
            text = self.getAtt("text")
            created_at = self.getAtt("created_at")
            print("user_timeline---"+ str(mid) +":"+ str(created_at)+":"+ text)
        timeline = self.api.user_timeline(count=20, page=2)
        
    def public_timeline(self):
        timeline = self.api.public_timeline(count=2, page=1)
        for line in timeline:
            self.obj = line
            mid = self.getAtt("id")
            text = self.getAtt("text")
            print("public_timeline---"+ str(mid) +":"+ text)
开发者ID:chengjun,项目名称:Research,代码行数:59,代码来源:getTimelines.py

示例8: Test

# 需要导入模块: from weibopy.auth import BasicAuthHandler [as 别名]
# 或者: from weibopy.auth.BasicAuthHandler import setAccessToken [as 别名]
class Test(unittest.TestCase):
    
    consumer_key=''
    consumer_secret=''
    
    def __init__(self):
            """ constructor """
    
    def getAtt(self, key):
        try:
            return self.obj.__getattribute__(key)
        except Exception as e:
            print(e)
            return ''
    
    def setAccessToken(self, key, secret):
        self.auth = OAuthHandler(self.consumer_key, self.consumer_secret)
        self.auth.setAccessToken(key, secret)
        self.api = API(self.auth, source=self.consumer_key)
        
    def basicAuth(self, source, username, password):
        self.authType = 'basicauth'
        self.auth = BasicAuthHandler(username, password)
        self.api = API(self.auth,source=source)
    def tags(self):
        tags = self.api.tags(user_id=1377583044)
        for line in tags:
            self.obj = line
            tagid=self.getAtt("id")
            value = self.getAtt(tagid)
            print (tagid,value)
    def tag_create(self ,message):
#        message = message.encode("utf-8")
        tag_create = self.api.tag_create(tags=message)
        for line in tag_create:
            self.obj = line
            tagid = self.getAtt("tagid")
            print ("tag_create---"+tagid)
    def tag_suggestions(self):
        tag_suggestions=self.api.tag_suggestions()
        for line in tag_suggestions:
            self.obj = line
            id = self.getAtt("id")
            value = self.getAtt("value")
            print ("tag_suggestions---"+ id +":"+ value)
    def tag_destroy(self,tag_id):
        tag_destroy=self.api.tag_destroy(tag_id)
        self.obj=tag_destroy
        result=self.getAtt("result")
        print ("tag_destroy---"+ result)
    def tag_destroy_batch(self,tag_ids):
        tag_destroy_batch=self.api.tag_destroy_batch(tag_ids)
        for line in tag_destroy_batch:
            self.obj = line
            tagid=self.getAtt("tagid")
            print ("tag_destroy_batch---"+ tagid)                        
开发者ID:chengjun,项目名称:Research,代码行数:58,代码来源:tags.py

示例9: Test

# 需要导入模块: from weibopy.auth import BasicAuthHandler [as 别名]
# 或者: from weibopy.auth.BasicAuthHandler import setAccessToken [as 别名]
class Test(unittest.TestCase):
    
    consumer_key=''
    consumer_secret=''
    
    def __init__(self):
            """ constructor """
    
    def getAtt(self, key):
        try:
            return self.obj.__getattribute__(key)
        except Exception as e:
            print(e)
            return ''
    
    def setAccessToken(self, key, secret):
        self.auth = OAuthHandler(self.consumer_key, self.consumer_secret)
        self.auth.setAccessToken(key, secret)
        self.api = API(self.auth)
        
    def basicAuth(self, source, username, password):
        self.auth = BasicAuthHandler(username, password)
        self.api = API(self.auth,source=source)
        
    def direct_message(self):
        messages = self.api.direct_messages()
        mid = ''
        for msg in messages:
            self.obj = msg
            mid = self.getAtt("id")
            text = self.getAtt("text")
            print("direct_message---"+ str(mid) +":"+ text)
        return mid
    
    def sent_direct_messages(self):
        messages = self.api.sent_direct_messages()
        for msg in messages:
            self.obj = msg
            mid = self.getAtt("id")
            text = self.getAtt("text")
            print("sent_direct_messages---"+ str(mid) +":"+ text)
            
    def new_direct_message(self):
        msg = self.api.new_direct_message(id=1114365581,text='directMessages--test-²âÊÔ-'+ str(time.time()))
        self.obj = msg
        mid = self.getAtt("id")
        text = self.getAtt("text")
        print("new_direct_message---"+ str(mid) +":"+ text)
            
    def destroy_direct_message(self, id):
        msg = self.api.destroy_direct_message(id)
        self.obj = msg
        mid = self.getAtt("id")
        text = self.getAtt("text")
        print("destroy_direct_message---"+ str(mid) +":"+ text)
开发者ID:chengjun,项目名称:Research,代码行数:57,代码来源:directMessages.py

示例10: Test

# 需要导入模块: from weibopy.auth import BasicAuthHandler [as 别名]
# 或者: from weibopy.auth.BasicAuthHandler import setAccessToken [as 别名]
class Test(unittest.TestCase):
    
    consumer_key=''
    consumer_secret=''
    
    def __init__(self):
            """ constructor """
    
    def getAtt(self, key):
        try:
            return self.obj.__getattribute__(key)
        except Exception as e:
            print(e)
            return ''
    
    def setAccessToken(self, key, secret):
        self.auth = OAuthHandler(self.consumer_key, self.consumer_secret)
        self.auth.setAccessToken(key, secret)
        self.api = API(self.auth)
        
    def basicAuth(self, source, username, password):
        self.auth = BasicAuthHandler(username, password)
        self.api = API(self.auth,source=source)
    
    def create_friendship(self):
        user = self.api.create_friendship(id=1114365581)
        self.obj = user
        uid = self.getAtt("id")
        screen_name = self.getAtt("screen_name")
        print("create_friendship---"+ str(uid) +":"+ screen_name)
        
    def destroy_friendship(self):
        user = self.api.destroy_friendship(id=1114365581)
        self.obj = user
        uid = self.getAtt("id")
        screen_name = self.getAtt("screen_name")
        print("destroy_friendship---"+ str(uid) +":"+ screen_name)
        
    def exists_friendship(self):
        self.obj = self.api.exists_friendship(user_a=1772333754, user_b=1773365880)
        friends = self.getAtt("friends")
        print("exists_friendship--- "+ str(friends))
        
    def show_friendship(self, uid):
        showList = self.api.show_friendship(target_id=uid)
        for obj in showList:
            self.obj = obj
            uid = self.getAtt("id")
            screen_name = self.getAtt("screen_name")
            print("show_friendship---"+ str(uid) +":"+ screen_name)
开发者ID:chengjun,项目名称:Research,代码行数:52,代码来源:friendships.py

示例11: Test

# 需要导入模块: from weibopy.auth import BasicAuthHandler [as 别名]
# 或者: from weibopy.auth.BasicAuthHandler import setAccessToken [as 别名]
class Test(unittest.TestCase):
    
    consumer_key=''
    consumer_secret=''
    
    def __init__(self):
            """ constructor """
    
    def getAtt(self, key):
        try:
            return self.obj.__getattribute__(key)
        except Exception as e:
            print(e)
            return ''
    
    def setAccessToken(self, key, secret):
        self.auth = OAuthHandler(self.consumer_key, self.consumer_secret)
        self.auth.setAccessToken(key, secret)
        self.api = API(self.auth)
        
    def basicAuth(self, source, username, password):
        self.authType = 'basicauth'
        self.auth = BasicAuthHandler(username, password)
        self.api = API(self.auth,source=source)
        
    def favorites(self):
        statuses = self.api.favorites(id=1773365880)
        for status in statuses:
            self.obj = status
            sid = self.getAtt("id")
            text = self.getAtt("text")
            print("favorites---"+ str(sid) +":"+ text)
        
    def create_favorite(self, id):
        status = self.api.create_favorite(id)
        self.obj = status
        sid = self.getAtt("id")
        text = self.getAtt("text")
        print("create_favorite---"+ str(sid) +":"+ text)
            
    def destroy_favorite(self, id):
        msg = self.api.destroy_favorite(id)
        self.obj = msg
        mid = self.getAtt("id")
        text = self.getAtt("text")
        print("destroy_favorite---"+ str(mid) +":"+ text)
开发者ID:chengjun,项目名称:Research,代码行数:48,代码来源:favorites.py

示例12: Test

# 需要导入模块: from weibopy.auth import BasicAuthHandler [as 别名]
# 或者: from weibopy.auth.BasicAuthHandler import setAccessToken [as 别名]
class Test(unittest.TestCase):
    
    consumer_key=''
    consumer_secret=''
    
    def __init__(self):
            """ constructor """
    
    def getAtt(self, key):
        try:
            return self.obj.__getattribute__(key)
        except Exception as e:
            print(e)
            return ''
    
    def setAccessToken(self, key, secret):
        self.auth = OAuthHandler(self.consumer_key, self.consumer_secret)
        self.auth.setAccessToken(key, secret)
        self.api = API(self.auth)
        
    def basicAuth(self, source, username, password):
        self.auth = BasicAuthHandler(username, password)
        self.api = API(self.auth,source=source)
    
    def friends_ids(self):
        fids = self.api.friends_ids()
        self.obj = fids
        ids = self.getAtt("ids")
        next_cursor = self.getAtt("next_cursor")
        previous_cursor = self.getAtt("previous_cursor")
        print("friends_ids---"+ str(ids) +":next_cursor"+ str(next_cursor) +":previous_cursor"+ str(previous_cursor))
        
    def followers_ids(self):
        fids = self.api.followers_ids()
        self.obj = fids
        ids = self.getAtt("ids")
        next_cursor = self.getAtt("next_cursor")
        previous_cursor = self.getAtt("previous_cursor")
        print("followers_ids---"+ str(ids) +":next_cursor"+ str(next_cursor) +":previous_cursor"+ str(previous_cursor))
开发者ID:chengjun,项目名称:Research,代码行数:41,代码来源:ids.py

示例13: Test

# 需要导入模块: from weibopy.auth import BasicAuthHandler [as 别名]
# 或者: from weibopy.auth.BasicAuthHandler import setAccessToken [as 别名]
class Test(unittest.TestCase):
    
    consumer_key=''
    consumer_secret=''
    
    def __init__(self):
            """ constructor """
    def getAtt(self, key):
        try:
            return self.obj.__getattribute__(key)
        except Exception as e:
            print(e)
            return ''
    
    def setAccessToken(self, key, secret):
        self.auth = OAuthHandler(self.consumer_key, self.consumer_secret)
        self.auth.setAccessToken(key, secret)
        self.api = API(self.auth)
        
    def basicAuth(self, source, username, password):
        self.auth = BasicAuthHandler(username, password)
        self.api = API(self.auth,source=source)    
    
    def update(self, message):
        status = self.api.update_status(lat='39', long='110', status=message)
        self.obj = status
        id = self.getAtt("id")
        text = self.getAtt("text")
        print("update---"+ str(id) +":"+ text)
        
    def destroy_status(self, id):
        status = self.api.destroy_status(id)
        self.obj = status
        id = self.getAtt("id")
        text = self.getAtt("text")
        print("update---"+ str(id) +":"+ text)
开发者ID:chengjun,项目名称:Research,代码行数:38,代码来源:oauthSetTokenUpdate.py

示例14: Test

# 需要导入模块: from weibopy.auth import BasicAuthHandler [as 别名]
# 或者: from weibopy.auth.BasicAuthHandler import setAccessToken [as 别名]
class Test(unittest.TestCase):
    
    consumer_key=''
    consumer_secret=''
    
    def __init__(self):
            """ constructor """
    
    def getAtt(self, key):
        try:
            return self.obj.__getattribute__(key)
        except Exception as e:
            print(e)
            return ''
    
    def setAccessToken(self, key, secret):
        self.auth = OAuthHandler(self.consumer_key, self.consumer_secret)
        self.auth.setAccessToken(key, secret)
        self.api = API(self.auth, source=self.consumer_key)
        
    def basicAuth(self, source, username, password):
        self.authType = 'basicauth'
        self.auth = BasicAuthHandler(username, password)
        self.api = API(self.auth,source=source)
    
    def trends(self):
        trends = self.api.trends(user_id=1377583044,count=20, page=1)
#        print str(len(trends))
        for line in trends:
            self.obj=line
            num = self.getAtt("num")
            trend_id = self.getAtt("trend_id")
            hotword = self.getAtt("hotword")
            print ("trends---"+ num +":"+ hotword +":"+trend_id)
    def trends_statuses(self , message):
        message = message.encode("utf-8")
        trends_statuses = self.api.trends_statuses(message)
        for line in trends_statuses:
            self.obj=line
            id = self.getAtt("id")
            text = self.getAtt("text")
            print ("ToReader---"+ str(id) + ":" +text)
#            print text 
    def trends_follow(self , message):
        message = message.encode("utf-8")
        trends_follow = self.api.trends_follow(message)
    def trends_destroy(self , id):
        trends_destroy=self.api.trends_destroy(id)
    def trends_hourly(self):
        trends_hourly = self.api.trends_hourly(base_app=0)
        self.obj=trends_hourly
        query = self.getAtt("trends")
        as_of = self.getAtt("as_of")
        for key in query:
            key = time.strftime('%Y-%m-%d',time.localtime(as_of))
            for line in query[key]:
                query = line["query"]
                name = line["name"]
                print ("trends_hourly---"+"Query:" + query+",Name:"+ name)
    def trends_daily(self):
        trends_daily=self.api.trends_daily(base_app=0)
        self.obj=trends_daily
        query=self.getAtt("trends")
        as_of=self.getAtt("as_of")
        for key in query:
            key=time.strftime('%Y-%m-%d',time.localtime(as_of))
            for line in query[key]:
                query=line["query"]
                name=line["name"]
                print ("trends_daily---"+"Query:" + query+",Name:"+ name) 
    def trends_weekly(self):
        trends_weekly=self.api.trends_weekly(base_app=0)
        self.obj=trends_weekly
        query=self.getAtt("trends")
        as_of=self.getAtt("as_of")
        for key in query:
            key = time.strftime('%Y-%m-%d',time.localtime(as_of))
            for line in query[key]:
                query=line["query"]
                name=line["name"]  
                print ("trends_weekly---"+"Query:" + query+",Name:"+ name)  
开发者ID:chengjun,项目名称:Research,代码行数:83,代码来源:trends.py

示例15: Test

# 需要导入模块: from weibopy.auth import BasicAuthHandler [as 别名]
# 或者: from weibopy.auth.BasicAuthHandler import setAccessToken [as 别名]
class Test(unittest.TestCase):
    
    consumer_key=''
    consumer_secret=''
    
    def __init__(self):
            """ constructor """
    
    def getAtt(self, key):
        try:
            return self.obj.__getattribute__(key)
        except Exception as e:
            print(e)
            return ''
    
    def setAccessToken(self, key, secret):
        self.auth = OAuthHandler(self.consumer_key, self.consumer_secret)
        self.auth.setAccessToken(key, secret)
        self.api = API(self.auth, source=self.consumer_key)
        
    def basicAuth(self, source, username, password):
        self.authType = 'basicauth'
        self.auth = BasicAuthHandler(username, password)
        self.api = API(self.auth,source=source)
        
    def comments(self, id):
        comments = self.api.comments(id=id)
        for comment in comments:
            self.obj = comment
            mid = self.getAtt("id")
            text = self.getAtt("text")
            print("comments---"+ str(mid) +":"+ text)
    
    def comments_timeline(self):
        comments = self.api.comments_timeline()
        for comment in comments:
            self.obj = comment
            mid = self.getAtt("id")
            text = self.getAtt("text")
            print("comments_timeline---"+ str(mid) +":"+ text)
    
    def comments_by_me(self):
        comments = self.api.comments_by_me(count=5)
        mid = ''
        for comment in comments:
            self.obj = comment
            mid = self.getAtt("id")
            text = self.getAtt("text")
            created_at = self.getAtt("created_at")
            print('comments_by_me,id='+ str(mid) +',text='+ text+',created_at='+ str(created_at))
        return mid
    
    def comment(self, mid):
        comment = self.api.comment(id=mid, comment='commect-test-²âÊÔ--'+ str(time.time()))
        self.obj = comment
        mid = self.getAtt("id")
        text = self.getAtt("text")
        print("comment---"+ str(mid) +":"+ text)
    
    def comment_destroy (self, mid):
        comment = self.api.comment_destroy(mid)
        self.obj = comment
        mid = self.getAtt("id")
        text = self.getAtt("text")
        print("comment_destroy---"+ str(mid) +":"+ text)
开发者ID:chengjun,项目名称:Research,代码行数:67,代码来源:comment.py


注:本文中的weibopy.auth.BasicAuthHandler.setAccessToken方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。