From 259399bc103f61daee068eefcd1f2d205a1c6816 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Tue, 8 Feb 2022 23:05:27 +0100 Subject: ver 0.1.0 --- rss_to_gitea/config.py | 2 +- rss_to_gitea/gitea.py | 2 +- rss_to_gitea/main.py | 13 +++++++++++-- 3 files changed, 13 insertions(+), 4 deletions(-) (limited to 'rss_to_gitea') diff --git a/rss_to_gitea/config.py b/rss_to_gitea/config.py index 1737a39..faf3350 100644 --- a/rss_to_gitea/config.py +++ b/rss_to_gitea/config.py @@ -94,7 +94,7 @@ class Config: def load(self, _dict): self.config = _dict - def __getattr__(self, _attr) -> float | int | Config | None: + def __getattr__(self, _attr) -> str | Config | None: if _attr not in self.config: return None diff --git a/rss_to_gitea/gitea.py b/rss_to_gitea/gitea.py index fcc985c..e1aa62a 100644 --- a/rss_to_gitea/gitea.py +++ b/rss_to_gitea/gitea.py @@ -46,7 +46,7 @@ class GiteaAPI: def createIssue(self, _owner, _repo, _title, _content, _assign, _labels): data={ 'assignee':_assign, -# 'body':_content, + 'body':_content, 'labels':_labels, 'title':_title } diff --git a/rss_to_gitea/main.py b/rss_to_gitea/main.py index c1a4a11..8d31197 100644 --- a/rss_to_gitea/main.py +++ b/rss_to_gitea/main.py @@ -16,10 +16,17 @@ USAGE: def main(): if len(sys.argv) <= 1: + print_help() return 1 config = Config(sys.argv[1]) - api = GiteaAPI("https://gitea.my.cum.re", config.token) + + token = config.token + if str.startswith(token, 'env/'): + splt = token.split('/',1) + token = os.environ[splt[1]] + + api = GiteaAPI(config.url, token) label_id = api.getLabelId(config.owner, config.repo, config.label) @@ -35,4 +42,6 @@ def main(): print(f'{issue_title} already exists. Skipping') continue - result = api.createIssue(config.owner, config.repo, issue_title, '', feed['assign'], [label_id]) + print(feed) + + result = api.createIssue(config.owner, config.repo, issue_title, latest['link'], feed['assign'], [label_id]) -- cgit v1.2.3