コード例 #1
0
    def imply_page(self, input_data):
        if not isinstance(input_data, dict):
            return None
        else:
            sprout_page = page()
            p_fields = sprout_page.get_fields()
            for el in p_fields.keys():
                if input_data.has_key(el):
                    sprout_page.set_field(el, input_data[el])
            return sprout_page

            #search_types = ['user', 'page', 'event', 'group']

    def search_pages(self, query):
        pages = self.__call_search(query, 'page',
            {'fields': 'name, likes, phone, talking_about_count, website, checkins'})
        for page_el in pages:
            s_page = self.imply_page(page_el)

            log.info(s_page)
            #getting connections
            for connection in page.connections:
                page_conn = self.__call_method(s_page.id,connection)
                log.info(page_conn)


if __name__ == '__main__':
    a = auth()
    token = a.get_fb_auth_token()
    fb = fb_engine(token)
    fb.search_pages('test')
コード例 #2
0
    def get_user_data(self, uid):
        return self._call_method(uid, 'getProfiles', fields)

    def get_user_followings(self, uid):
        return self._call_method(uid, 'subscriptions.get', {'count': 1000})

    def get_user_followers(self, uid):
        return self._call_method(uid, 'subscriptions.getFollowers', {'count': 1000})

    def get_likes(self, uid):
        users = self._call_method(uid, 'fave.getUsers', fields)
        log.info(users)
        photos = self._call_method(uid, 'fave.getPhotos', {})
        log.info(photos)
        videos = self._call_method(uid, 'fave.getVideos', {})
        log.info(videos)
        posts = self._call_method(uid, 'fave.getPosts', {})
        log.info(posts)
        links = self._call_method(uid, 'fave.getLinks', {})
        log.info(links)


if __name__ == '__main__':
    o = auth()
    token = o.get_vk_auth_token()
    vk = vk_engine(token)
    vk.get_friends(props.vk_uid)

    vk.get_likes(props.vk_uid)