Coder Social home page Coder Social logo

pyndlsearch's Introduction

pyndlsearch

MIT License  

Python wrapper of NDL Search.

Requirements

  • Python 3.5.2
  • requests 2.10.0

Instration

pip install pyndlsearch

SRU(Search/Retrieve Via URL)

http://iss.ndl.go.jp/api/sru

  • version: 1.2
  • query: CQL
  • startRecord: default 1
  • maximumRecords: default 200
  • recordPacking: default "string"
  • recordSchema: default "dc"
  • inprocess: default "false"
  • onlyBib: default "false"

Usage

# -*- coding: utf-8 -*-

from pyndlsearch.client import SRUClient
from pyndlsearch.cql import CQL


if __name__ == '__main__':
    # CQL検索クエリの組み立て
    cql = CQL()
    cql.title = 'Python'
    cql.fromdate = '2000-10-10'
    #print(cql.payload())

    # NDL Searchクライアントの設定
    client = SRUClient(cql)
    client.set_maximum_records(2)
    #print(client)
    
    # get_response()ではxml形式で取得可能
    #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)

  • 出力結果
10日でおぼえるPython入門教室
穂苅実紀夫, 寺田学, 中西直樹, 堀田直孝, 永井孝 著
1500円定番ARMマイコン・ボードで試して合点! アプリはスクリプトで柔軟に!マイコン用MicroPythonプログラミング
中村 晋一郎

注意

  • デフォルトだと200件取りに行ってしまうためちゃくちゃ遅いです
  • SRUClientの最大件数を調節してください

pyndlsearch's People

Contributors

nocotan avatar kasajei avatar dependabot[bot] avatar

Stargazers

 avatar haywhnk avatar thinkAmi avatar  avatar saru999 avatar  avatar Shuntaro Yada avatar himkt avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.