diff options
Diffstat (limited to 'rss_to_gitea/main.py')
-rw-r--r-- | rss_to_gitea/main.py | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/rss_to_gitea/main.py b/rss_to_gitea/main.py index 93c16de..f4425a2 100644 --- a/rss_to_gitea/main.py +++ b/rss_to_gitea/main.py @@ -1,8 +1,34 @@ import xml import sys +import yaml +import os +import sys + from .gitea import GiteaAPI +from .atom import AtomFeed + + +feeds = [ + { + 'name':'Gitea', + 'url':'https://github.com/go-gitea/gitea/releases.atom', + 'exclude':['dev', 'rc'], + 'assign':'' + } +] + +def load_yaml(_file: str): + required = ['feeds', 'token', 'url'] + config = {} + + with open(_file, 'r') as f: + config = yaml.load(f.read(), Loader=yaml.FullLoader) + + return config def main(): - token = sys.argv[1] - api = GiteaAPI("https://gitea.my.cum.re", token) - api.searchIssue('infra', 'ansible', '', 'update') + #token = sys.argv[1] + #api = GiteaAPI("https://gitea.my.cum.re", token) + #api.searchIssue('infra', 'ansible', '', 'update') + feed = AtomFeed(feeds[0]['url']) + print(feed.get_latest([])) |