-
Notifications
You must be signed in to change notification settings - Fork 32
Pivovar Sergey #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Pivovar Sergey #46
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( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Из тех задания (вторая итерация):
This package should export CLI utility named rss-reader.
К сожалению, данный пакет не создает такой утилиты
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Если запускать так, как описано в readme файле, то базовый функционал первых двух итераций работает.
Но все таки нужно добавить создание утилиты после установки пакета. (entry_points аргумент в setup функции)
rss-reader/output_controller.py
Outdated
:type articles: dict | ||
""" | ||
logging.info("Start sample output") | ||
if (title := articles.get('title', None)) is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Первый раз вижу функционал из самого нового пайтона. Молодец :)
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
@@ -0,0 +1,346 @@ | |||
import datetime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Падает генерация 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)
Added rss_reader
Iteration 1.
Working on the model. Description shows excess HTML tags and other. Does not support setting "--json".