Using the National Diet Library Search API in Python

API to use

National Diet Library Search Externally Provided Interface (API)

Library to use

https://github.com/nocotan/pyndlsearch

Example

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

Description

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

pyndlsearch

Recommended Posts

Using the National Diet Library Search API in Python
Try using the Wunderlist API in Python
Tweet using the Twitter API in Python
Try using the BitFlyer Ligntning API in Python
Try using the DropBox Core API in Python
Initial settings when using the foursquare API in python
Getting the arXiv API in Python
Hit the Sesami API in Python
Hit the web API in Python
Access the Twitter API in Python
Depth-first search using stack in Python
Mouse operation using Windows API in Python
Get Youtube data in Python using Youtube Data API
What is "mahjong" in the Python library? ??
In search of the fastest FizzBuzz in Python
Try hitting the YouTube API in Python
Regularly upload files to Google Drive using the Google Drive API in Python
Create an application that just searches using the Google Custom Search API with Python 3.3.1 in Bottle
How to use the C library in Python
I checked the library for using the Gracenote API
Get image URL using Flickr API in Python
Tips for hitting the ATND API in Python
Pre-process the index in Python using Solr's ScriptUpdateProcessor
Use the LibreOffice app in Python (3) Add library
[Modint] Decoding the AtCoder Library ~ Implementation in Python ~
Hit the Firebase Dynamic Links API in Python
Try using ChatWork API and Qiita API in Python
Binary search in Python
Evernote API in Python
Linear search in Python
Search Twitter using Python
C API in Python 3
Binary search in Python (binary search)
To automatically send an email with an attachment using the Gmail API in Python
Continue to retrieve tweets containing specific keywords using the Streaming API in Python
Upload JPG file using Google Drive API in Python
Determine the threshold using the P tile method in python
Get LEAD data using Marketo's REST API in Python
OpenVINO using Inference Engine Python API in PC environment
Using the LibreOffice app in Python (1) Where are the macros?
A little bit from Python using the Jenkins API
[Internal_math version (2)] Decoding the AtCoder Library ~ Implementation in Python ~
A note on the library implementation that explores hyperparameters using Bayesian optimization in Python
A story about a Python beginner trying to get Google search results using the API
Hit Mastodon's API in Python
Download the file in Python
Find the difference in Python
Try using the Twitter API
Search algorithm using word2vec [python]
Overriding library functions in Python
Binary search in Python / C ++
Algorithm in Python (binary search)
Try using the Twitter API
Try using the PeeringDB 2.0 API
Blender Python API in Houdini (Python 3)
Call the API with python3.
Translate using googletrans in Python
Using Python mode in Processing
I tried using the Python library from Ruby with PyCall
Get your heart rate from the fitbit API in Python!
How to debug the Python standard library in Visual Studio