Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
catalogue
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
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
labs-team
catalogue
Commits
94fd2ff1
Commit
94fd2ff1
authored
6 years ago
by
gabriele-h
Browse files
Options
Downloads
Patches
Plain Diff
Correct SRU query, extend list instead of append
parent
2cc0d882
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
sru/almasru.py
+7
-7
7 additions, 7 deletions
sru/almasru.py
with
7 additions
and
7 deletions
sru/almasru.py
+
7
−
7
View file @
94fd2ff1
...
...
@@ -72,7 +72,7 @@ class RecordRetriever:
}
def
get_unique
(
self
,
alma_query
:
str
)
->
Element
:
"""
Return one MARC XML record for a
specific query
.
"""
Return one MARC XML record for a
query by unique ID
.
:param alma_query: URI-parameter query for SRU request
:return: XML as etree-Element
...
...
@@ -82,7 +82,7 @@ class RecordRetriever:
:raises SruDiagnostics: if SRU returns an error
"""
startrecord
=
0
startrecord
=
1
sru_url
=
self
.
_create_url
(
alma_query
,
startrecord
)
sru_xml
=
self
.
_response_to_xml
(
sru_url
)
...
...
@@ -95,7 +95,7 @@ class RecordRetriever:
return
xml_list
[
0
]
def
get_multiple
(
self
,
alma_query
:
str
)
->
list
:
"""
Return
one
MARC XML record for a specific query.
"""
Return
list ofo
MARC XML record
s
for a specific query.
:param alma_query: URI-parameter query for SRU request
:return: XML as list of etree-Elements
...
...
@@ -104,7 +104,7 @@ class RecordRetriever:
:raises SruDiagnostics: if SRU returns an error
"""
startrecord
=
0
startrecord
=
1
sru_url
=
self
.
_create_url
(
alma_query
,
startrecord
)
sru_xml
=
self
.
_response_to_xml
(
sru_url
)
...
...
@@ -118,17 +118,17 @@ class RecordRetriever:
for
i
in
range
(
num_pages
):
startrecord
=
i
*
10
startrecord
=
(
i
+
1
)
*
10
+
1
sru_url
=
self
.
_create_url
(
alma_query
,
startrecord
)
sru_xml
=
self
.
_response_to_xml
(
sru_url
)
xml_list
.
app
end
(
self
.
_extract_marc_xml
(
sru_xml
))
xml_list
.
ext
end
(
self
.
_extract_marc_xml
(
sru_xml
))
return
xml_list
def
_create_url
(
self
,
alma_query
:
str
,
startrecord
:
int
)
->
str
:
self
.
url_query
[
'
startRecord
'
]
=
str
(
startrecord
)
self
.
url_query
[
'
maximumRecords
'
]
=
'
1
'
self
.
url_query
[
'
maximumRecords
'
]
=
'
1
0
'
self
.
url_query
[
'
query
'
]
=
alma_query
url_query_string
=
parse
.
urlencode
(
self
.
url_query
)
sru_url
=
self
.
url_base
+
url_query_string
...
...
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