code formatting

This commit is contained in:
Hugh Rundle 2021-11-16 20:40:22 +11:00
parent 03c59f2431
commit 8658e36ca8
No known key found for this signature in database
GPG key ID: CD23D6039184286B

View file

@ -2,19 +2,20 @@
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
import requests import requests
def request_isni_data(search_index, search_term, max_records=5): def request_isni_data(search_index, search_term, max_records=5):
"""Request data from the ISNI API""" """Request data from the ISNI API"""
search_string = f'{search_index}="{search_term}"' search_string = f'{search_index}="{search_term}"'
query_params = { query_params = {
"query" : search_string, "query": search_string,
"version" : "1.1", "version": "1.1",
"operation" : "searchRetrieve", "operation": "searchRetrieve",
"recordSchema" : "isni-b", "recordSchema": "isni-b",
"maximumRecords" : max_records, "maximumRecords": max_records,
"startRecord" : "1", "startRecord": "1",
"recordPacking" : "xml", "recordPacking": "xml",
"sortKeys" : "RLV,pica,0,," "sortKeys": "RLV,pica,0,,",
} }
result = requests.get("http://isni.oclc.org/sru/", params=query_params) result = requests.get("http://isni.oclc.org/sru/", params=query_params)
# the OCLC ISNI server asserts the payload is encoded # the OCLC ISNI server asserts the payload is encoded