Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scrappers
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
bibliovid
scrappers
Commits
a70841cb
Commit
a70841cb
authored
5 years ago
by
Benoit Favre
Browse files
Options
Downloads
Patches
Plain Diff
fix problems with pubmed servers disconnecting
parent
8f9d71d4
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
bibliovid_add_abstract.py
+17
-9
17 additions, 9 deletions
bibliovid_add_abstract.py
with
17 additions
and
9 deletions
bibliovid_add_abstract.py
+
17
−
9
View file @
a70841cb
...
...
@@ -5,6 +5,8 @@ import sys, json, re, collections
from
pymed
import
PubMed
from
datetime
import
datetime
,
date
import
requests
import
time
pubmed
=
PubMed
(
tool
=
"
https://covid19.lis-lab.fr
"
,
email
=
"
benoit.favre@univ-amu.fr
"
)
...
...
@@ -32,6 +34,8 @@ for article in articles['results']:
found
=
False
for
query
in
[
'
(%s[Title] AND (%s[Author])
'
%
(
preprocess
(
title
),
preprocess
(
authors
)),
'
%s[Title]
'
%
preprocess
(
title
),
preprocess
(
title
)]:
for
retries
in
range
(
10
):
try
:
results
=
pubmed
.
query
(
query
,
max_results
=
30
)
for
result
in
results
:
entry
=
result
.
toDict
()
...
...
@@ -42,6 +46,10 @@ for article in articles['results']:
article
[
field
]
=
entry
[
field
]
stats
[
field
]
+=
1
break
break
except
requests
.
exceptions
.
HTTPError
as
e
:
print
(
e
,
file
=
sys
.
stderr
)
time
.
sleep
(
5
)
if
found
:
break
if
not
found
:
...
...
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