예제 #1
0
    def get_yaca_image(cls, site):
        from yandex_ci_parser.yaca import YacaCi

        url = YacaCi.get_url(site)
        res = requests.get(url)
        res.raise_for_status()
        try:
            ci = YacaCi.result(res.text, site)
        except IncorrectParserError:
            from yandex_ci_parser.image import ImageCi

            url = ImageCi.get_url(site)
            res = requests.get(url)
            res.raise_for_status()
            ci = ImageCi.result(res.content)

        return ci
예제 #2
0
 def get_image(cls, site):
     from yandex_ci_parser.image import ImageCi
     url = ImageCi.get_url(site)
     res = requests.get(url)
     res.raise_for_status()
     return ImageCi.result(res.text)
예제 #3
0
 def test1(self):
     content = self.get_data('ci-apartlux.ru.gif')
     res = ImageCi.result(content)
     self.assertEqual(res, 150)
예제 #4
0
 def test4(self):
     content = self.get_data('ci-yandex.ru.gif')
     res = ImageCi.result(content)
     self.assertEqual(res, 500000)
예제 #5
0
 def test3(self):
     content = self.get_data('ci-titapet.ru.gif')
     res = ImageCi.result(content)
     self.assertEqual(res, None)
예제 #6
0
 def test2(self):
     content = self.get_data('ci-bdbd.ru.gif')
     res = ImageCi.result(content)
     self.assertEqual(res, 1600)