Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
events-wrangler
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VALLET Nathan
events-wrangler
Commits
e37a6e0a
Commit
e37a6e0a
authored
1 year ago
by
VALLET Nathan
Browse files
Options
Downloads
Patches
Plain Diff
Add config file
parent
bec53db7
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
aggreg.py
+11
-7
11 additions, 7 deletions
aggreg.py
with
11 additions
and
7 deletions
aggreg.py
+
11
−
7
View file @
e37a6e0a
...
...
@@ -2,7 +2,8 @@ import feedparser
from
urllib.parse
import
urlparse
from
datetime
import
datetime
import
time
from
argparse
import
ArgumentParser
import
yaml
def
charge_urls
(
liste_url
:
list
[
str
])
->
list
[
dict
[
str
,
any
]
|
None
]:
# if the key 'bozo' is true, then the feed had an error during processing, so we set it to None
...
...
@@ -55,12 +56,15 @@ def genere_html(liste_evenements: list[dict[str, str]],
def
main
():
urls
=
[
f
"
http://192.168.78.
{
i
}
/rss.xml
"
for
i
in
range
(
3
,
15
)]
charge
=
charge_urls
(
urls
)
evenements
=
fusion_flux
(
urls
,
charge
,
None
)
print
(
evenements
)
genere_html
(
evenements
,
"
aggreg.html
"
)
parser
=
ArgumentParser
(
description
=
"
obtain events feeds from RSS and compile them into a nice webpage
"
)
parser
.
add_argument
(
"
-c
"
,
"
--config
"
,
help
=
"
specifies a config path instead of the default config path %(default)
"
,
default
=
"
/etc/eventswrangler.conf
"
)
configpath
=
parser
.
parse_args
().
config
with
open
(
configpath
)
as
file
:
conf
=
yaml
.
safe_load
(
file
)
urls
=
[
source
+
'
/
'
+
conf
[
'
rss-name
'
]
for
source
in
conf
[
'
sources
'
]]
feeds
=
charge_urls
(
urls
)
fusioned
=
fusion_flux
(
urls
,
feeds
,
conf
[
'
tri-chrono
'
])
genere_html
(
fusioned
,
conf
[
'
destination
'
])
if
__name__
==
"
__main__
"
:
main
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment