Esempio n. 1
0
    def call_read_collection(self, id):
        '''
        Reads the collection with the specified id.

        :type id: int
        :param id: the collection id
        :return: the collection details
        :rtype: CollectionL1
        '''

        response = self.get('/collections/{}'.format(id))

        col_dict = json.loads(response.body_string())
        col = CollectionL1(**col_dict)

        # author caching
        for au in col.authors:
            caching.add_author(au.id, au.full_name)

        return col
Esempio n. 2
0
    def call_read_collection(self, id):
        '''
        Reads the collection with the specified id.

        :type id: int
        :param id: the collection id
        :return: the collection details
        :rtype: CollectionL1
        '''

        response = self.get('/collections/{}'.format(id))

        col_dict = json.loads(response.body_string())
        col = CollectionL1(**col_dict)

        # author caching
        for au in col.authors:
            caching.add_author(au.id, au.full_name)

        return col
Esempio n. 3
0
    def call_read_my_article(self, id):
        '''
        Read one of your articles.

        :type id: int
        :param id: the article id
        :return: the article details
        :rtype: ArticleL2
        '''

        response = self.get('/account/articles/{}'.format(id),
                            headers=get_headers(token=self.token))

        article_dict = json.loads(response.body_string())
        # print article_dict
        article = ArticleL2(**article_dict)

        # cache authors
        for au in article.authors:
            caching.add_author(au.id, au.full_name)
        return article
Esempio n. 4
0
    def call_read_my_article(self, id):
        '''
        Read one of your articles.

        :type id: int
        :param id: the article id
        :return: the article details
        :rtype: ArticleL2
        '''

        response = self.get('/account/articles/{}'.format(id),
                            headers=get_headers(token=self.token))

        article_dict = json.loads(response.body_string())
        # print article_dict
        article = ArticleL2(**article_dict)

        # cache authors
        for au in article.authors:
            caching.add_author(au.id, au.full_name)
        return article