Oleg_Slavashevich_oslavashevish@gmail.com#15
Conversation
| @@ -0,0 +1,20 @@ | |||
| import argparse | |||
|
|
|||
| parser = argparse.ArgumentParser(description='Getting info from sites') | |||
There was a problem hiding this comment.
Entire logic of this module should placed in a function.
| @@ -0,0 +1,61 @@ | |||
| import feedparser | |||
| from pprint import pprint | |||
| from myargparse import * | |||
There was a problem hiding this comment.
Please, do not use import * in your solutions
| import json | ||
|
|
||
|
|
||
| def parse(url): |
There was a problem hiding this comment.
I'm not sure that you have to add this function. All it does - return result of another function.
|
Please check your code for PEP8 compliance. You can use such tools as |
|
Here is some feedback on your application work:
Please do not forget that you have to add |
| @@ -0,0 +1,22 @@ | |||
| INFO:root:Website is working | |||
There was a problem hiding this comment.
Please, remove your local .log file from repository
| @@ -0,0 +1,15 @@ | |||
| import logging | |||
| from clean_output import clean_title | |||
There was a problem hiding this comment.
This is an unused import
|
|
||
|
|
||
| def logg(article): | ||
| logging.debug("Title: " + clear_title(article['title'])) |
There was a problem hiding this comment.
This code is not working, because there is no clear_title function
| import re | ||
|
|
||
| def clean_title(text): | ||
| "Delete unnecessary symbols" |
There was a problem hiding this comment.
Here and below: please make your docstrings a bit more specific
|
|
Please fix your commit messages as some of them do not correspond to commit message guidelines. |
|
Please thoroughly test your app before pushing your commits to the remote repository. |
| parser.add_argument( | ||
| '--limit', | ||
| type=int, | ||
| help='Limit news topics if this parameter provided' | ||
| ) |
There was a problem hiding this comment.
Here and below: it is ok to make that into one line. It will be readable anyway.
| month = {'Jan': '1', | ||
| 'Feb': '2', | ||
| 'Mar': '3', | ||
| 'Apr': '4', | ||
| 'May': '5', | ||
| 'Jun': '6', | ||
| 'Jul': '7', | ||
| 'Aug': '8', | ||
| 'Sep': '9', | ||
| 'Oct': '10', | ||
| 'Nov': '11', | ||
| 'Dec': '12'} | ||
| day = date[5:7] | ||
| month_int = month[date[8:11]] | ||
| year = date[12:16] |
There was a problem hiding this comment.
It is better to use datetime lib for this.
| @@ -0,0 +1,107 @@ | |||
| import feedparser | |||
| #from arg import parsargs, VERSION | |||
There was a problem hiding this comment.
please avoid commented-out code in pushed commits.
| for i in articles: | ||
| var = True | ||
| for j in news_csv: | ||
| if i['published'] != j[4]: |
There was a problem hiding this comment.
It is better to avoid one-character variable names.
| with open('news.csv', 'a', newline='') as csvfile: | ||
| fieldnames = ['link','title', 'img', 'summary', 'published'] | ||
|
|
||
| writer = csv.DictWriter(csvfile, fieldnames=fieldnames) | ||
|
|
||
| writer.writerow(articles) |
There was a problem hiding this comment.
As far as I understand if you will get news 5 times from the same rss source, then you will have these news 5 times repeated in your file
| addcsv(i) | ||
|
|
||
| def main(): | ||
| console_args = arg.parsargs() |
There was a problem hiding this comment.
If you import specific function using from then you should just use it as is: parsargs, without arg
Right now this will break your application.
| a = [] | ||
| with open('news.csv', 'r') as csvFile: | ||
| reader = csv.reader(csvFile) | ||
| for row in reader: | ||
| a.append(row) |
There was a problem hiding this comment.
If there is no such file (and the first time you launch program on new machine there won't be such file) this line will crash your application with FileNotFoundError


No description provided.