diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2022-02-08 23:05:27 +0100 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2022-02-08 23:05:27 +0100 |
commit | 259399bc103f61daee068eefcd1f2d205a1c6816 (patch) | |
tree | 383ca1ad52f895c19db43fd6df841ef59c140f75 /rss_to_gitea | |
parent | 75556cabf2ad0fd7a136f9f8b0a9d311045c32ba (diff) | |
download | atom_to_gitea-259399bc103f61daee068eefcd1f2d205a1c6816.tar.gz |
ver 0.1.0
Diffstat (limited to 'rss_to_gitea')
-rw-r--r-- | rss_to_gitea/config.py | 2 | ||||
-rw-r--r-- | rss_to_gitea/gitea.py | 2 | ||||
-rw-r--r-- | rss_to_gitea/main.py | 13 |
3 files changed, 13 insertions, 4 deletions
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]) |