National Diet Library Search Externally Provided Interface (API)
https://github.com/nocotan/pyndlsearch
test.py
# -*- coding: utf-8 -*-
from pyndlsearch.client import SRUClient
from pyndlsearch.cql import CQL
if __name__ == '__main__':
    #Constructing a CQL search query
    cql = CQL()
    cql.title = 'Python'
    cql.fromdate = '2000-10-10'
    #print(cql.payload())
    #NDL Search Client Settings
    client = SRUClient(cql)
    client.set_maximum_records(2)
    #print(client)
    # get_response()Can be obtained in xml format
    #res = client.get_response()
    #print(res.text)
    # SRU
    srres = client.get_srresponse()
    for record in srres.records:
        print(record.recordData.title)
        print(record.recordData.creator)
--Output result
Python introductory class to remember in 10 days
Mikio Hogari,Manabu Terata,Naoki Nakanishi,Naotaka Hotta,By Takashi Nagai
1500 yen Try with a standard ARM microcomputer board and get a point!The app is flexible with scripts!MicroPython programming for microcontrollers
Shinichiro Nakamura
Assemble and search the search query called CQL described in API Specifications.
Response can use get_srresponse () to get the structured one or get_response () to get the raw xml.
searchRetrieveResponse
Recommended Posts