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 | |
parent | 75556cabf2ad0fd7a136f9f8b0a9d311045c32ba (diff) | |
download | atom_to_gitea-259399bc103f61daee068eefcd1f2d205a1c6816.tar.gz |
ver 0.1.0
-rw-r--r-- | README.md | 1 | ||||
-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 | ||||
-rwxr-xr-x | setup.py | 4 |
5 files changed, 15 insertions, 7 deletions
diff --git a/README.md b/README.md deleted file mode 100644 index 42c90e4..0000000 --- a/README.md +++ /dev/null @@ -1 +0,0 @@ -# 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]) @@ -3,7 +3,7 @@ import setuptools setup( name='rsstogitea', - version='0.0.0-dev', + version='0.1.0', author="Jonas Gunz", description="Create a Gitea Issue for new RSS entries", packages=['rss_to_gitea'], @@ -15,7 +15,7 @@ setup( "pyyaml" ], license='All rights reserved', - long_description=open('README.md').read(), + long_description=open('Readme.md').read(), long_description_content_type="text/markdown", classifiers=[ "Programming Language :: Python :: 3", |