Skip to content

Oleg_Slavashevich_oslavashevish@gmail.com#15

Open
OlegSlavashevich wants to merge 11 commits into
epam-python-courses-7-bsu:masterfrom
OlegSlavashevich:master
Open

Oleg_Slavashevich_oslavashevish@gmail.com#15
OlegSlavashevich wants to merge 11 commits into
epam-python-courses-7-bsu:masterfrom
OlegSlavashevich:master

Conversation

@OlegSlavashevich

Copy link
Copy Markdown

No description provided.

Comment thread final_task/rss_reader/myargparse.py Outdated
@@ -0,0 +1,20 @@
import argparse

parser = argparse.ArgumentParser(description='Getting info from sites')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entire logic of this module should placed in a function.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Comment thread final_task/rss_reader/rss_reader.py Outdated
@@ -0,0 +1,61 @@
import feedparser
from pprint import pprint
from myargparse import *

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, do not use import * in your solutions

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

Comment thread final_task/rss_reader/rss_reader.py Outdated
import json


def parse(url):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that you have to add this function. All it does - return result of another function.

Comment thread final_task/rss_reader/rss_reader.py Outdated
@HenadziStantchik

Copy link
Copy Markdown
Collaborator

Please check your code for PEP8 compliance. You can use such tools as pycodestyle (but make maximum line length to 120 when you check)

Comment thread final_task/rss_reader/rss_reader.py Outdated
Comment thread final_task/rss_reader/rss_reader.py Outdated
@HenadziStantchik

Copy link
Copy Markdown
Collaborator

Here is some feedback on your application work:

  1. There should not be any HTML-code in the printed feed.

  2. Your application has encoding problem:

image

  1. If user did not specify the limit, he/she should get all available feed, not just one entry.

Please do not forget that you have to add --version and --verbose arguments in Iteration 1.

@OlegSlavashevich OlegSlavashevich changed the title Oleg_Slavashevich_oslavashevish@gmail.com Oleg_Slavashevich_oslavashevish@gmail.com - PLEASE REVIEW Nov 14, 2019
@@ -0,0 +1,22 @@
INFO:root:Website is working

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, remove your local .log file from repository

Comment thread final_task/rss_reader/loggs.py Outdated
@@ -0,0 +1,15 @@
import logging
from clean_output import clean_title

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an unused import

Comment thread final_task/rss_reader/loggs.py Outdated


def logg(article):
logging.debug("Title: " + clear_title(article['title']))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code is not working, because there is no clear_title function

@dzhigailo dzhigailo changed the title Oleg_Slavashevich_oslavashevish@gmail.com - PLEASE REVIEW Oleg_Slavashevich_oslavashevish@gmail.com Nov 14, 2019
Comment thread final_task/rss_reader/arg.py Outdated
import re

def clean_title(text):
"Delete unnecessary symbols"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and below: please make your docstrings a bit more specific

Comment thread final_task/rss_reader/clean_output.py Outdated
Comment thread final_task/rss_reader/rss_reader.py Outdated
Comment thread final_task/setup.py
@HenadziStantchik

Copy link
Copy Markdown
Collaborator
  1. --verbose does not work: I get a NameError exception with traceback to stdout.

  2. it is impossible to use --version without specifying RSS url

@HenadziStantchik

Copy link
Copy Markdown
Collaborator

Please fix your commit messages as some of them do not correspond to commit message guidelines.

@HenadziStantchik

Copy link
Copy Markdown
Collaborator

Please thoroughly test your app before pushing your commits to the remote repository.

Comment thread final_task/rss_reader/rss_reader.py Outdated
Comment on lines +8 to +12
parser.add_argument(
'--limit',
type=int,
help='Limit news topics if this parameter provided'
)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and below: it is ok to make that into one line. It will be readable anyway.

Comment on lines +3 to +17
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]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to use datetime lib for this.

@@ -0,0 +1,107 @@
import feedparser
#from arg import parsargs, VERSION

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please avoid commented-out code in pushed commits.

Comment on lines +53 to +56
for i in articles:
var = True
for j in news_csv:
if i['published'] != j[4]:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is better to avoid one-character variable names.

Comment on lines +4 to +9
with open('news.csv', 'a', newline='') as csvfile:
fieldnames = ['link','title', 'img', 'summary', 'published']

writer = csv.DictWriter(csvfile, fieldnames=fieldnames)

writer.writerow(articles)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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()

@HenadziStantchik HenadziStantchik Dec 3, 2019

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +12 to +16
a = []
with open('news.csv', 'r') as csvFile:
reader = csv.reader(csvFile)
for row in reader:
a.append(row)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@HenadziStantchik

Copy link
Copy Markdown
Collaborator

Here is feedback on your app:
Unfortunatelly your app does not work:
image

There are no tests.
The code is mostly readable, but does not correspond to the PEP8 guidelines. You may want to use pycodestyle tool in the future.
Commit messages could be more informative, however they mostly correspond to the recommended commit message style.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants