SciPost Code Repository
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SciPost
Manage
Activity
Members
Labels
Plan
Issues
118
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container 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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SciPost
SciPost
Commits
728b537d
Commit
728b537d
authored
6 years ago
by
Boris Ponsioen
Browse files
Options
Downloads
Patches
Plain Diff
Readds error handling in get_crossref_test temporarily
parent
d3ac1661
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
metacore/services.py
+21
-18
21 additions, 18 deletions
metacore/services.py
with
21 additions
and
18 deletions
metacore/services.py
+
21
−
18
View file @
728b537d
...
...
@@ -28,31 +28,34 @@ def get_crossref_test(cursor='*'):
print
(
"
Last cursor:
"
,
last_cursor
)
print
(
"
Current cursor:
"
,
cursor
)
params
=
{
'
cursor
'
:
cursor
,
'
rows
'
:
rows
,
'
mailto
'
:
'
b.g.t.ponsioen@uva.nl
'
}
r
=
requests
.
get
(
url
,
params
=
params
)
r_json
=
r
.
json
()
citables_json
=
r_json
[
'
message
'
][
'
items
'
]
last_cursor
=
cursor
cursor
=
r_json
[
'
message
'
][
'
next-cursor
'
]
number_of_results
=
len
(
r_json
[
'
message
'
][
'
items
'
])
citables
=
[
parse_crossref_citable
(
it
)
for
it
in
citables_json
]
citables
=
[
citable
for
citable
in
citables
if
citable
is
not
None
]
for
j
in
range
(
0
,
2
):
params
=
{
'
cursor
'
:
cursor
,
'
rows
'
:
rows
,
'
mailto
'
:
'
b.g.t.ponsioen@uva.nl
'
}
r
=
requests
.
get
(
url
,
params
=
params
)
r_json
=
r
.
json
()
citables_json
=
r_json
[
'
message
'
][
'
items
'
]
last_cursor
=
cursor
cursor
=
r_json
[
'
message
'
][
'
next-cursor
'
]
number_of_results
=
len
(
r_json
[
'
message
'
][
'
items
'
])
citables
=
[
parse_crossref_citable
(
it
)
for
it
in
citables_json
]
citables
=
[
citable
for
citable
in
citables
if
citable
is
not
None
]
# Mass insert in database (will fail on encountering existing documents
# with same DOI
if
citables
:
Citable
.
objects
.
insert
(
citables
)
break
else
:
print
(
"
Trying again
"
)
# Mass insert in database (will fail on encountering existing documents
# with same DOI
if
citables
:
Citable
.
objects
.
insert
(
citables
)
citable
=
[]
if
number_of_results
<
rows
:
print
(
number_of_results
)
print
(
'
End reached.
'
)
break
citable
=
[]
def
convert_doi_to_lower_case
():
# If you accidentally import 100.000+ records that have random uppercase characters
# in their reference DOI list
...
...
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