diff options
author | kvakanet <kvakanet@users.noreply.github.com> | 2017-02-12 19:31:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-12 19:31:11 +0300 |
commit | 13304cfa97702ac688346bca7274c13cae94478a (patch) | |
tree | 49eb2cdd452a18b5d1f4f405a44afac84af77b14 | |
parent | 37f4f3c2bce7bcd3049c3f814fe226cfde7ccde6 (diff) | |
parent | b450d5a466e1cc35d77d3b52e95b466450f9f7ca (diff) |
Merge pull request #1 from icoz/master
Обновление01
-rw-r--r-- | .travis.yml | 11 | ||||
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | habr/topic.py | 12 | ||||
-rw-r--r-- | requirements.txt | 26 |
4 files changed, 29 insertions, 21 deletions
diff --git a/.travis.yml b/.travis.yml index f0a0253..9e584c7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,13 @@ language: python +branches: + only: + master python: - - "3.3" - - "3.4" - "3.5" + - "3.6" # command to install dependencies install: "pip install -r requirements.txt" # command to run tests -script: python -m unittest habr/user.py -script: python -m unittest habr/topic.py +script: + - python -m unittest habr/user.py + - python -m unittest habr/topic.py @@ -40,6 +40,7 @@ Changelog: - Добавлены мета теги для лучшего поиска PDF - Исправлена вставка автора(вставляется ссылка на автора рабочая) - Решана проблема с маштабированием изображений +- Теперь тестируется только python 3.5 и 3.6, на других версиях тоже может работать. *01.02.2015* - исправлены ошибки diff --git a/habr/topic.py b/habr/topic.py index fdf56f9..d83d8e4 100644 --- a/habr/topic.py +++ b/habr/topic.py @@ -50,12 +50,16 @@ class TMTopic(object): if len(post_title) == 0: raise PostDeleted self.post['title'] = post_title - tmp = doc.xpath("//div[@class='author-info__username']//a[@class='author-info__nickname']") or \ - doc.xpath("//div[@class='author-info__username']//a[@class='author-info__name']") or \ - doc.xpath("//div[@class='author-info__username']//span[@class='author-info__name']") + tmp = \ + doc.xpath("//div[@class='author-info__username']//a[@class='author-info__nickname']") or \ + doc.xpath("//div[@class='author-info__username']//a[@class='author-info__name']") or \ + doc.xpath("//div[@class='author-info__username']//span[@class='author-info__name']") if len(tmp): - self.post['author_url'] = ('https://' + self.domain + tmp[0].attrib['href'] ) self.post['author'] = tmp[0].text + if tmp[0].attrib.get('href'): + self.post['author_url'] = ('https://' + self.domain + tmp[0].attrib['href'] ) + else: + self.post['author_url'] = "https://{}/users/{}".format(self.domain, self.post['author']) else: self.post['author_url']= '' self.post['author'] = '' diff --git a/requirements.txt b/requirements.txt index 83aed1c..7d3c6a3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,15 +1,15 @@ +six>=1.10.0 cairocffi>=0.7.2 CairoSVG>=2.0.0 -cffi==1.9.1 -cssselect==1.0.0 -docopt==0.6.2 -html5lib==0.999999999 -lxml==3.7.0 -Pillow==3.4.2 -pycparser==2.17 -Pyphen==0.9.4 -requests==2.12.3 -six==1.10.0 -tinycss==0.4 -WeasyPrint>=0.34 -webencodings==0.5 +cffi>=1.9.1 +cssselect>=1.0.0 +docopt>=0.6.2 +html5lib>=0.999999999 +lxml>=3.7.0 +Pillow>=3.4.2 +pycparser>=2.17 +Pyphen>=0.9.4 +requests>=2.12.3 +tinycss>=0.4 +WeasyPrint>=0.33 +webencodings>=0.5 |