Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SAE203
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
ZHANG David
SAE203
Commits
0a544b7e
Commit
0a544b7e
authored
3 years ago
by
ZHANG David
Browse files
Options
Downloads
Patches
Plain Diff
Update aggreg.py
parent
a68748c4
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
aggreg.py
+6
-0
6 additions, 0 deletions
aggreg.py
with
6 additions
and
0 deletions
aggreg.py
+
6
−
0
View file @
0a544b7e
...
@@ -12,6 +12,7 @@ from datetime import datetime
...
@@ -12,6 +12,7 @@ from datetime import datetime
def
charge_urls
(
liste_url
):
def
charge_urls
(
liste_url
):
#Cette fonction récupère les flux RSS#
res
=
[]
res
=
[]
for
i
in
range
(
1
,
len
(
liste_url
)):
for
i
in
range
(
1
,
len
(
liste_url
)):
news_feed
=
feedparser
.
parse
(
liste_url
[
i
])
news_feed
=
feedparser
.
parse
(
liste_url
[
i
])
...
@@ -20,6 +21,7 @@ def charge_urls(liste_url):
...
@@ -20,6 +21,7 @@ def charge_urls(liste_url):
return
res
return
res
def
fusion_flux
(
liste_url
,
liste_flux
):
def
fusion_flux
(
liste_url
,
liste_flux
):
#Cette fonction extrait les éléments utiles des flux RSS #
sortie
=
[]
sortie
=
[]
for
i
in
range
(
0
,
len
(
liste_flux
)):
for
i
in
range
(
0
,
len
(
liste_flux
)):
doc_rss
=
liste_flux
[
i
]
doc_rss
=
liste_flux
[
i
]
...
@@ -36,6 +38,7 @@ def fusion_flux(liste_url, liste_flux):
...
@@ -36,6 +38,7 @@ def fusion_flux(liste_url, liste_flux):
return
sortie
return
sortie
def
genere_html
(
liste_evenements
,
chemin_html
):
def
genere_html
(
liste_evenements
,
chemin_html
):
#Cette fonction génére la page qui affiche les événements des flux RSS#
file
=
open
(
chemin_html
,
'
w
'
)
file
=
open
(
chemin_html
,
'
w
'
)
html_code_debut
=
"""
html_code_debut
=
"""
<!DOCTYPE html>
<!DOCTYPE html>
...
@@ -186,10 +189,12 @@ main {
...
@@ -186,10 +189,12 @@ main {
}
}
"""
"""
file
=
open
(
"
feed.css
"
,
'
w
'
)
file
=
open
(
"
feed.css
"
,
'
w
'
)
#chemin vers le fichier ou vous voulez générer le code css ( configurable)#
file
.
write
(
css_code
)
file
.
write
(
css_code
)
file
.
close
file
.
close
def
main
():
def
main
():
#Le programme principal#
liste_url
=
sys
.
argv
liste_url
=
sys
.
argv
res
=
charge_urls
(
liste_url
)
res
=
charge_urls
(
liste_url
)
liste_flux
=
res
liste_flux
=
res
...
@@ -213,6 +218,7 @@ def main():
...
@@ -213,6 +218,7 @@ def main():
for
entry
in
news_feed
.
entries
:
for
entry
in
news_feed
.
entries
:
print
(
f
"
{
entry
[
'
title
'
]
}
-->
{
entry
[
'
link
'
]
}
"
)
print
(
f
"
{
entry
[
'
title
'
]
}
-->
{
entry
[
'
link
'
]
}
"
)
chemin_html
=
"
page_html.html
"
chemin_html
=
"
page_html.html
"
#chemin vers le fichier ou vous voulez générer le code html#
liste_evenements
=
sortie
liste_evenements
=
sortie
genere_html
(
liste_evenements
,
chemin_html
)
genere_html
(
liste_evenements
,
chemin_html
)
print
(
liste_evenements
)
print
(
liste_evenements
)
...
...
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