def test_follow_with_url(self): """ 带url,返回follower数量 :return: """ time.sleep(1) zhihu = Zhihu() data = zhihu.follow(profile_url="https://www.zhihu.com/people/gao-yu-dong-41") self.assertIn('follower_count', data)
def test_follow_with_user_slug(self): """ 带user_slug,返回follower数量 :return: """ time.sleep(1) zhihu = Zhihu() data = zhihu.follow(user_slug="xiaoxiaodouzi") self.assertIn('follower_count', data)
# encoding: utf-8 import time from zhihu import Zhihu __author__ = 'liuzhijun' if __name__ == '__main__': zhihu = Zhihu() # profile = zhihu.user(profile_url="https://www.zhihu.com/people/xiaoxiaodouzi") # time.sleep(1) # profile = zhihu.user(user_slug="xiaoxiaodouzi") # time.sleep(1) # # _id = profile.get("id") # print(_id) # # 3a2be5588fefcbc13ba4459cd8f1b5bc # # 1da75b85900e00adb072e91c56fd9149 # zhihu.send_message("你好,问候1", profile_url="https://www.zhihu.com/people/xiaoxiaodouzi") # time.sleep(1) # zhihu.send_message("你好,问候2", user_slug="xiaoxiaodouzi") # time.sleep(1) # zhihu.send_message("你好,问候3", user_id=_id) zhihu.follow(profile_url="https://www.zhihu.com/people/gao-yu-dong-41")