-
Notifications
You must be signed in to change notification settings - Fork 32
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
[WIP] Lastin Egor #41
base: master
Are you sure you want to change the base?
[WIP] Lastin Egor #41
Conversation
Created functions to find and separate feeds, using https://news.yahoo.com/rss/ like in the example. Got into grips with the argparse module on a different computer(added parts of it as a docstring to the python script).
|
||
# A list to hold all headlines,links,..... | ||
|
||
allheadlines=[] |
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.
в глобальной секции не должно быть никакой логики. нужно перенести в функции/классы.
return links | ||
|
||
#def getTimes( rs_url) | ||
def getHeadlines( rss_url ): |
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.
есть много стилистических ошибок
советую посмотреть в сторону утилиты pycodestyle
mostly finished iteration 1 and had a go with iteration 2. Iteration one has a working rss reader with a working limit and url parameter, Cleaned up the code a bit with logic and pycodestyle |
Added the option to add to file. the file is called news.txt and takes the standard feed from feedparser. the type of it is feedparserdict. Still need to add classes and take ALL of the logic out, most of it has been done, same with pycodestyle
pep'd and docstring'd. variable name changed
added a -j for json dumping into the console. pycodestyled again
Added more arguments. Namely a -date for task 3 and a -con for converting to pdf and some other niche. The current functions are stubs for testing purposes.
@@ -0,0 +1,8 @@ | |||
from setuptools import setup, find_packages | |||
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.
после установки утилиты в чистом докер контейнере через pip install .
не появляется утилита rss-reader
# rss-reader --help
bash: rss-reader: command not found
"""import section""" | ||
|
||
version = 0.1 | ||
parser = argparse.ArgumentParser() |
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.
все еще есть много кода, который хранится в глобальной секции
нужно все перетащить как минимум в функции
print("a") | ||
|
||
|
||
def captureFeed(URL): |
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.
названия методом должны быть маленькими буквами через нижнее подчеркивание
например capture_feed
"""Outputs a json dump of feed.entries to a file that is called "news.txt".works """ | ||
open("news.txt", "w").close() | ||
feed = captureFeed(args.URL) | ||
f = open("news.txt", "w+") |
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.
для работы с файлами имеет смысл использовать контекстные менеджеры
Created functions to find and separate feeds, using https://news.yahoo.com/rss/ like in the example.
Got into grips with the argparse module on a different computer(added parts of it as a docstring to the python script).