aboutsummaryrefslogtreecommitdiff
path: root/rss_to_gitea/main.py
blob: f4425a262474a8283b111ce0df51c2d693ed4224 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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')
    feed = AtomFeed(feeds[0]['url'])
    print(feed.get_latest([]))