Pivovar Sergey#46
Open
TeRRoRlsT wants to merge 43 commits intointroduction-to-python-bsuir-2019:masterfrom
Open
Pivovar Sergey#46TeRRoRlsT wants to merge 43 commits intointroduction-to-python-bsuir-2019:masterfrom
TeRRoRlsT wants to merge 43 commits intointroduction-to-python-bsuir-2019:masterfrom
Conversation
Iteration 1. Working on the model. Description shows excess HTML tags and other. Does not support setting "--json".
Added:
* File htmlparser. Contain all parsing functionality of program.
* Added docstrings in all files.
* Added logging. To use write '--verbose' after filename.
* Added converting to JSON. Also now available output all news articles in JSON format.
Change:
* Functionality of class RSSReader. All parsing work removed into htmlparser module.
Fixed all files with PEP8
Added:
* Added __init__.py
* Added setup.py
* Added README.md
* Added package `rss-reader` with project files
Change:
* Project structure
* In file `rss_reader.py` change import module `htmlparser` -> `.htmlparser`
Fixed all files with PEP8
In file `rss_reader.py` fix local import '.htmlparser' -> 'htmlparser'
Change:
* In file `rss_reader` change struct. Remove all parse functions to `htmlparser`.
* In file `htmlparser` added model Article. Rewrite all method of class HTMLParser for work with model Article.
* In all files fix docstrings with PEP8.
Fix all files with PEP8.
Change:
* Added in module `rss_reader` caching articles. Rewrite logging. Rewrite docstrings. Rewrite getting version of application
* From module `htmlparser` remove model Article. Change docstrings. Change method HTMLParser.parse, now it return list of dicts of articles
* Update version to `0.9`
Fix all files with PEP8
Added:
* `models` with ORM models for working with db
* `/managers/` in module with managers of relevant models
* `controller` with storage controller for work with db
Fix all files with PEP8
… TO_HTML` + change signature of main RSSReader method. Update docstrings
…+ fix bugs + fix imports in `rss_reader`
…dded SamplePrintController + added JSONPrintController. All extends abstract BaseController
Changes:
* Moved loading/saving data control logic to Article model from controller
* Extend model Article with 2 fields `dec_description` and `dec_links`
* Rewrite docstrings with PEP8
…g sequence + change method work with field pubDate
Fixed docstring in rss_reader
…ocstrings with PEP8
|
|
||
| PACKAGE = 'rss-reader' | ||
|
|
||
| setup( |
Collaborator
There was a problem hiding this comment.
Из тех задания (вторая итерация):
This package should export CLI utility named rss-reader.
К сожалению, данный пакет не создает такой утилиты
Collaborator
There was a problem hiding this comment.
Если запускать так, как описано в readme файле, то базовый функционал первых двух итераций работает.
Но все таки нужно добавить создание утилиты после установки пакета. (entry_points аргумент в setup функции)
| :type articles: dict | ||
| """ | ||
| logging.info("Start sample output") | ||
| if (title := articles.get('title', None)) is not None: |
Collaborator
There was a problem hiding this comment.
Первый раз вижу функционал из самого нового пайтона. Молодец :)
Updates:
* Update README with PEP8 and update code lines
* All imports are rewritten to absolute paths from packages. Some imports remained relative to the package
* Renamed Source Root to `rssreader`
* Fix docstring with PEP8
* Fix setup.py. Now it creates a utility `rss-reader`
Added server wrapper for implementation of `rss-reader` utility
AlexeiBuzuma
reviewed
Dec 5, 2019
| @@ -0,0 +1,346 @@ | |||
| import datetime | |||
Collaborator
There was a problem hiding this comment.
Падает генерация PDF для tut.by
Для ссылки из тех задания все работает корректно
# rss-reader https://news.tut.by/rss/world.rss --to-pdf /data/my_news.pdf
Traceback (most recent call last):
File "/usr/local/bin/rss-reader", line 8, in <module>
sys.exit(main())
File "/usr/local/lib/python3.8/site-packages/rssreader/rss_reader.py", line 129, in main
RSSReader()(settings.source,
File "/usr/local/lib/python3.8/site-packages/rssreader/rss_reader.py", line 80, in __call__
OutputController.print(articles, **kwargs)
File "/usr/local/lib/python3.8/site-packages/rssreader/output_controller.py", line 389, in print
PDFPrintController().print_to(articles, filename=to_pdf)
File "/usr/local/lib/python3.8/site-packages/rssreader/output_controller.py", line 183, in print_to
writer.output(print_to)
File "/usr/local/lib/python3.8/site-packages/fpdf/fpdf.py", line 1065, in output
self.close()
File "/usr/local/lib/python3.8/site-packages/fpdf/fpdf.py", line 246, in close
self._enddoc()
File "/usr/local/lib/python3.8/site-packages/fpdf/fpdf.py", line 1636, in _enddoc
self._putpages()
File "/usr/local/lib/python3.8/site-packages/fpdf/fpdf.py", line 1170, in _putpages
p = self.pages[n].encode("latin1") if PY3K else self.pages[n]
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 59-65: ordinal not in range(256)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added rss_reader
Iteration 1.
Working on the model. Description shows excess HTML tags and other. Does not support setting "--json".