Exemple #1
0
 def __next__(self):
     builder = self.get_next_urlbuilder()
     url = builder.update_params(p=self.current_page)
     self.current_page += 1
     csv_page = self.adapter.get_text(url)
     contents = [i for i in csv.parse(csv_page, self.api) if i.is_valid]
     if len(contents) == 0:
         raise StopIteration()
     return contents
Exemple #2
0
 def test_parse_line_illust(self):
     contents = list(csv.parse(SAMPLE_LINE_ILLUST, None))  # api is not used for now
     assert_equal(1, len(contents))
     illust = contents[0]
     assert_equals(illust.illust_id, 12345678)
     assert_equal(illust.author_id, 1234567)
     assert_equal(illust.extension, 'jpg')
     assert_equal(illust.comments, 982)
     assert_equal(illust.points, 9770)
     assert_equal(illust.views, 13361)
     assert_equal(illust.caption, 'Caption String')
     assert_equals(illust.author_name, 'username')
     assert_list_equal(illust.tags, ['hoge', 'fuga', '>foo'])
     assert_list_equal(illust.tools, ['Photoshop', 'SAI'])
     assert_equal(datetime(2013, 9, 9, 17, 00, 43), illust.timestamp)
     # Illust specific
     assert_equal(illust.pages, None)
     assert_equal(illust.image_url, 'http://i1.pixiv.net/img35/img/username/12345678.jpg')