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
a97bb08f
Commit
a97bb08f
authored
1 year ago
by
VALLET Nathan
Browse files
Options
Downloads
Patches
Plain Diff
add guid retrieval and use properties instead of dictionary key lookup
parent
10234043
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
+11
-8
11 additions, 8 deletions
aggreg.py
with
11 additions
and
8 deletions
aggreg.py
+
11
−
8
View file @
a97bb08f
...
@@ -2,7 +2,6 @@ import feedparser
...
@@ -2,7 +2,6 @@ import feedparser
from
urllib.parse
import
urlparse
from
urllib.parse
import
urlparse
from
datetime
import
datetime
from
datetime
import
datetime
def
charge_urls
(
liste_url
:
list
[
str
])
->
list
[
dict
[
str
,
any
]
|
None
]:
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
# if the key 'bozo' is true, then the feed had an error during processing, so we set it to None
return
[
return
[
...
@@ -14,13 +13,14 @@ def charge_urls(liste_url: list[str]) -> list[dict[str, any] | None]:
...
@@ -14,13 +13,14 @@ def charge_urls(liste_url: list[str]) -> list[dict[str, any] | None]:
def
fusion_flux
(
liste_url
:
list
[
str
],
liste_flux
:
list
[
dict
[
str
,
any
]
|
None
],
def
fusion_flux
(
liste_url
:
list
[
str
],
liste_flux
:
list
[
dict
[
str
,
any
]
|
None
],
tri_chrono
:
bool
)
->
list
[
dict
[
str
,
str
]]:
tri_chrono
:
bool
)
->
list
[
dict
[
str
,
str
]]:
feeds
=
[{
feeds
=
[{
'
titre
'
:
entry
[
'
title
'
],
'
titre
'
:
entry
.
title
,
'
categorie
'
:
entry
[
'
category
'
],
'
categorie
'
:
entry
.
category
,
'
serveur
'
:
urlparse
(
entry
[
'
title_detail
'
][
'
base
'
]).
netloc
,
'
serveur
'
:
urlparse
(
entry
.
title_detail
.
base
).
netloc
,
'
date_publi
'
:
entry
[
'
published
'
],
'
date_publi
'
:
entry
.
published
,
'
lien
'
:
entry
[
'
link
'
],
'
lien
'
:
entry
.
link
,
'
description
'
:
entry
[
'
description
'
]
'
description
'
:
entry
.
description
,
}
for
feed
in
liste_flux
for
entry
in
feed
[
'
entries
'
]]
'
guid
'
:
entry
.
guid
}
for
feed
in
liste_flux
if
feed
is
not
None
for
entry
in
feed
[
'
entries
'
]]
if
tri_chrono
:
if
tri_chrono
:
feeds
.
sort
(
key
=
lambda
e
:
datetime
.
strptime
(
e
[
'
date_publi
'
],
feeds
.
sort
(
key
=
lambda
e
:
datetime
.
strptime
(
e
[
'
date_publi
'
],
"
%a, %d %b %Y %H:%M
"
),
"
%a, %d %b %Y %H:%M
"
),
...
@@ -32,3 +32,6 @@ def fusion_flux(liste_url: list[str], liste_flux: list[dict[str, any] | None],
...
@@ -32,3 +32,6 @@ def fusion_flux(liste_url: list[str], liste_flux: list[dict[str, any] | None],
def
main
():
def
main
():
raise
NotImplementedError
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