Roman_Shagun_rshag17@gmail.com#24
Conversation
Add exceptions.py for custom exceptions Add logger.py for convenient output managment Add rss_feed.py to represent whole rss rss feed Add rss_item.py to store a single news item Implement rss_reader.py Add non-standart libs in requirements.txt
- Add tests for RssFeed and RssItem classes. - Refactor rss_reader.init_feed(): add new func to init list of news_items separately - Change RssFeed.print_feed() to be more convenient for usage and testing - Add README
|
If the |
- Implement setup.py - Add installation guide to README - Refactor code to log without custom logger - Fix PEP8 issues in rss_feed.py - Refactor rss_item.py to decode symbols via html lib - Remove standart libs fom requirements.txt - Fix var name issues in rss_feed.py
|
Your app does not work if user tries to run it without using setuptools. ( |
- Fix function names - Fix global variables names - Use slices in rss_reader.init_news_list - Implement manual adding of packages in setup.py - Change project structure to fix import errors - Change README - Add test for rss_reader.py - Add test test_feed.xml as test feed
|
Here is some feedback on your app work:
Keep in mind that it should not have encoding problems too.
|
- Fix multiple exit points - Add DESCRIPTION - Fix --date now working with --json - Refactor rss_reader to be more clear - Add converters to .pdf and .html
| @@ -0,0 +1 @@ | |||
| !coverage.py: This is a private format, don't read it directly!{"lines":{"/home/mdalag/Documents/epam_task/FinalTaskRssParser/final_task/rss_reader/converters.py":[1,2,3,5,6,7,8,10,12,13,15,19,20,21,22,23,24,25,26,27,28,29,30,31,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,76,78,87,88,89,90,91,92,93,96,158],"/home/mdalag/Documents/epam_task/FinalTaskRssParser/final_task/rss_reader/exceptions_.py":[1,4,5,8,9,12,13],"/home/mdalag/Documents/epam_task/FinalTaskRssParser/final_task/rss_reader/rss_feed.py":[1,2,3,4,5,6,7,8,10,11,13,14,17,18,19,20,21,22,23,24,25,26,27,28,29,31,32,33,34,35,36,37,38,45,46,47,49,50,52,53,54,55,56,61,62,63,64,65,67,68,69,70,71,72,73,74,75,76,77,78,79],"/home/mdalag/Documents/epam_task/FinalTaskRssParser/final_task/rss_reader/rss_reader.py":[1,2,3,4,5,6,7,8,9,10,11,13,14,15,16,19,22,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,120,132,141,157,159,168,183,199,201,206],"/home/mdalag/Documents/epam_task/FinalTaskRssParser/final_task/rss_reader/rss_item.py":[1,2,3,4,5,8,17,18,19,20,21,22,23,24,25,27,28,29,30,32,33,34,35,36,37,38,39,40,41,42,43,44,45,47,48,50,51,52,53,54,56,57,59,60,62,63],"/home/mdalag/Documents/epam_task/FinalTaskRssParser/final_task/__init__.py":[1],"/home/mdalag/Documents/epam_task/FinalTaskRssParser/final_task/rss_reader/__init__.py":[1]}} No newline at end of file | |||
There was a problem hiding this comment.
Please, add this file and file below to .gitignore
| @@ -0,0 +1 @@ | |||
| !coverage.py: This is a private format, don't read it directly!{"lines":{"/usr/local/lib/python3.7/dist-packages/rss_reader-1.0-py3.7.egg/tests/test_rss_item.py":[1,2,3,4,6,7,10,12],"/home/mdalag/Documents/epam_task/FinalTaskRssParser/final_task/rss_reader/rss_item.py":[1,2,3,4,5,8,17,18,19,20,21,22,23,24,25,27,32,33,45,52,62],"/home/mdalag/.local/lib/python3.7/site-packages/jsonpickle/__init__.py":[55,56,58,59,60,63,64,65,66,67,68,70,73,76,77,78,79,80,81,84,85],"/home/mdalag/.local/lib/python3.7/site-packages/jsonpickle/backend.py":[1,129,3,132,133,6,135,268,269,270,16,17,146,19,274,277,21,24,25,28,30,31,32,36,167,39,169,42,44,45,46,175,47,48,49,51,59,198,200,77,205,99,101,230,102,103,106,107,112,113,116,249,122,125,126],"/home/mdalag/.local/lib/python3.7/site-packages/jsonpickle/compat.py":[1,2,3,4,33,6,7,8,10,11,13,14,15,16,17,18,19,20],"/usr/lib/python3/dist-packages/simplejson/__init__.py":[132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,402,403,408,538,158,288,573,466,99,100,101,103,104,105,108,110,112,113,114,115,116,117,118,119,123,125],"/usr/lib/python3/dist-packages/simplejson/errors.py":[2,3,6,38,40,15,52,26],"/usr/lib/python3/dist-packages/simplejson/raw_json.py":[8,2,4,7],"/usr/lib/python3/dist-packages/simplejson/decoder.py":[2,3,4,5,6,7,8,137,10,11,12,13,139,140,16,143,144,272,20,22,24,25,29,30,31,33,36,37,38,41,43,44,300,47,304,49,50,51,348,349,350,351,352,353,354,355,356,357,358,359,360,361,363,236,376],"/usr/lib/python3/dist-packages/simplejson/compat.py":[32,2,3,4,34,20,21,22,25,27,28,29,30,31],"/usr/lib/python3/dist-packages/simplejson/scanner.py":[2,3,4,5,6,7,8,11,13,15,16,17,20,85],"/usr/lib/python3/dist-packages/simplejson/encoder.py":[2,3,4,5,7,8,9,10,11,12,137,138,15,139,17,18,147,20,21,22,275,24,25,26,27,28,29,30,406,32,34,36,38,427,428,429,430,431,304,432,433,434,435,436,437,438,439,65,395,397,229,230,231,232,233,234,107,235,109,236,237,238,239,240,241,242,243,245,246,248,250,252,254,383],"/home/mdalag/.local/lib/python3.7/site-packages/jsonpickle/pickler.py":[7,8,9,10,11,12,139,14,15,16,17,18,19,144,149,533,158,34,546,295,171,559,307,181,184,314,322,581,592,598,216,220,606,99,612,487,622,111,495,241,244],"/home/mdalag/.local/lib/python3.7/site-packages/jsonpickle/util.py":[257,387,517,137,10,11,12,13,14,15,16,17,18,147,20,21,22,23,276,25,535,28,29,156,287,32,165,174,46,49,179,307,440,188,323,327,455,456,202,459,333,340,471,526,220,479,97,231,369,114,498,499,500,503,377,510,127],"/home/mdalag/.local/lib/python3.7/site-packages/jsonpickle/tags.py":[8,9,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],"/home/mdalag/.local/lib/python3.7/site-packages/jsonpickle/handlers.py":[129,9,10,11,12,13,14,140,16,17,144,141,20,22,23,24,152,26,153,164,44,174,175,176,179,180,182,186,61,190,193,66,71,72,199,200,203,76,207,82,83,84,85,210,211,88,213,90,216,220,226,227,100,229,233,109,237,121],"/home/mdalag/.local/lib/python3.7/site-packages/jsonpickle/unpickler.py":[134,7,8,9,392,11,12,13,14,15,16,522,20,661,664,155,667,285,541,292,550,167,295,678,44,173,301,308,53,439,696,574,325,328,456,586,80,81,209,336,84,212,598,87,216,91,92,219,222,96,100,484,104,108,110,498,117,501,504,635],"/home/mdalag/.local/lib/python3.7/site-packages/jsonpickle/version.py":[1]}} No newline at end of file | |||
There was a problem hiding this comment.
All .coverage related files should be added to .gitignore
| path += '/feed-' + str(datetime.datetime.now()) + get_extention(mode) | ||
| try: | ||
| LOGGER.debug('TRYING TO CREATE FILE...') | ||
| export_file = open(path, 'w', encoding='utf-8') |
There was a problem hiding this comment.
'w' flag in open function will always create new file if one not exists or overwrite existing file. If you want to check if path is valid, you could use tools from os lib
Also, please always use context manager while working with files.
Aside from this, i did not discover any issues with Iteration 4 work |
| pdf.set_x(4) | ||
| pdf.cell(20, 6, 'Description:', ln=1) | ||
| pdf.set_x(20) | ||
| if len(news_item['description']) == 0: |
There was a problem hiding this comment.
if not news_item['description']:
- Fix indicated errors - Use pkg_resources for dynamic font detection - Change .pdf font to handle more symbols - Add font to MANIFEST.in - Fix unescaped characters in json and html - Change README.md setup section - Add tests for rss_reader
|
I did not discover any issues with Iteration 4 functionality, but be sure to test it thoroughly in case I missed something |
- Add colored output for news feed via colorama
- Convertion now works on Windows
| usage: rss_reader.py [-h] [--version] [--json] [--verbose] [--limit LIMIT] [--date DATE] [source] | ||
|
|
||
| RRS feed receiver | ||
|
|
||
| positional arguments: | ||
| source URL for RSS feed | ||
|
|
||
| optional arguments: | ||
| -h, --help show this help message and exit | ||
| --version prints version | ||
| --json converts news to JSON | ||
| --verbose output verbose status messages | ||
| --limit LIMIT determines the number of showed news. | ||
| --date DATE shows cached news at given date | ||
| --to_pdf TO_PDF coverts news to PDF. | ||
| --to_html TO_HTML coverts news to HTML. | ||
|
|
||
| TO_PDF/TO_HTML - path to directory for file | ||
| File's name is in format feed-*current datetime*.*extention* |
There was a problem hiding this comment.
It seems you forgot to add --colorize here.
| return temp_img | ||
|
|
||
|
|
||
| def get_pdf_doc(news_list): |
There was a problem hiding this comment.
This function is too large, it is better to try to split it.
| @@ -0,0 +1,3 @@ | |||
| Some shit happend :c with imports and I was had to run tests from /FinalTaskRssParser dir like this | |||
There was a problem hiding this comment.
Please do not use such language on work in any form.

No description provided.