Skip to main content

A package that enables the Calil Library API to be used from Python.

Project description

pycalil

カーリル図書館APIをpythonから使えるようにしたパッケージ

※事前にAPIキーの取得をお願いします

Requirement

  • requests

installation

pip install pycalil

Usage

from pycalil import Pycalil

apikey = "your apikey"
calil = Pycalil(apikey)
# library:https://api.calil.jp/library -----------------------------
# 指定した条件で図書館の一覧を取得する

# pref:都道府県で指定する
# city:市区町村で指定する ※prefとセットで使う。
print(calil.library(pref="青森県", city="青森市"))

"""
json([{"category": "SMALL", "city": "青森市", "short": "中央市民センター", "libkey": "中央市民センター", "pref": "青森県", "primary": false, "faid": null, "geocode": "140.7608082,40.8206974", "systemid": "Aomori_Aomori", "address": "青森県青森市松原1丁目6番15号", "libid": "100251", "tel": "017-734-0163", "systemname": "青森県青森市", "isil": null, "post": "030-0813", "url_pc": "http://www.city.aomori.aomori.jp/chuo-center/kodomo-kyouiku/shimin-center/kouminkan/06.html", "formal": "青森市中央市民センター図書室"},...
"""

# systemid:図書館のシステムIDで指定する
print(calil.library(systemid="Aomori_Pref"))

"""
json([{"category": "LARGE", "city": "青森市", "short": "青森県立図書館 ", "libkey": "青県図", "pref": "青森県", "primary": true, "faid": "FA012896", "geocode": "140.7385051,40.7952048", "systemid": "Aomori_Pref", "address": "青森県青森市荒川藤戸119-7 ", "libid": "100287", "tel": "017-739-4211", "systemname": "青森県立図書館", "isil": "JP-1000175", "post": "030-0184", "url_pc": "http://www.plib.pref.aomori.lg.jp/top/index.html", "formal": "青森県立図書館 "}]);
"""

# geocode:緯度、軽度で指定する
print(calil.library(geocode="136.7163027,35.390516"))

"""
json([{"category": "SPECIAL", "city": "岐阜市", "short": "岐阜県総合教育センター", "libkey": "本館", "distance": 0.00025125403859339114, "pref": "岐阜県", "primary": true, "faid": null, "geocode": "136.7163027,35.3905132", "systemid": "Gifu_Education_Center", "address": "岐阜県岐阜市薮田南5丁目9-1 岐阜県総合教育センター本館3階", "libid": "100853", "tel": "058-271-3404", "systemname": "岐阜県総合教育センター", "isil": "JP-1005642", "post": "500-8384", "url_pc": "http://www.gifu-net.ed.jp/ssd/tosyo/index.html", "formal": "岐阜県総合教育センター図書・教育資料室"},
"""

# limit:取得するデータの件数を指定
print(calil.library(pref="青森県", city="青森市", limit=2))

"""
json([{"category": "SMALL", "city": "青森市", "short": "中央市民センター", "libkey": "中央市民センター", "pref": "青森県", "primary": false, "faid": null, "geocode": "140.7608082,40.8206974", "systemid": "Aomori_Aomori", "address": "青森県青森市松原1丁目6番15号", "libid": "100251", "tel": "017-734-0163", "systemname": "青森県青森市", "isil": null, "post": "030-0813", "url_pc": "http://www.city.aomori.aomori.jp/chuo-center/kodomo-kyouiku/shimin-center/kouminkan/06.html", "formal": "青森市中央市民センター図書室"}, {"category": "SMALL", "city": "青森市", "short": "北部市民センター", "libkey": "北部市民センター", "pref": "青森県", "primary": false, "faid": null, "geocode": "140.6759542,40.8862817", "systemid": "Aomori_Aomori", "address": "青森県青森市奥内字宮田41番地3", "libid": "100252", "tel": "017-754-2244", "systemname": "青森県青森市", "isil": null, "post": "038-0054", "url_pc": "http://www.city.aomori.aomori.jp/chuo-center/kodomo-kyouiku/shimin-center/kouminkan/02.html", "formal": "青森市北部地区農村環境改善センター(北部市民センター)図書室"}]);
None
"""

# check:https://api.calil.jp/check
# 図書館に対して蔵書の有無と貸出状況を問い合わせる 

# isbn:第一引数。書籍のISBNを指定する
# systemid:第二引数。システムIDを指定します
print(calil.check([4003400313], ["Tokyo_NDL"]))

"""
json({"session": "2461f8923302e3dfd5e2a52bec9dad57", "continue": 0, "books": {"4003400313": {"Tokyo_NDL": {"status": "OK", "libkey": {"東京本館": "蔵書あり"}, "reserveurl": "https://ndlonline.ndl.go.jp/#!/detail/R300000001-I000002695283-00"}}}});
"""

Note

APIに関して引数や戻り値などの詳しい仕様

Author

License

"pycalil" is under MIT license.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycalil-1.4.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

pycalil-1.4-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file pycalil-1.4.tar.gz.

File metadata

  • Download URL: pycalil-1.4.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for pycalil-1.4.tar.gz
Algorithm Hash digest
SHA256 062fc6d2f816e8950174818146d92d4a2f026ac9f71a120e9b66154d3db7b951
MD5 74bd9093712c9cb945b8f21f72cdf5b8
BLAKE2b-256 30187d7e7ef9f6487d91771e1188bc15b327238e698d975be47b719d76ed4455

See more details on using hashes here.

File details

Details for the file pycalil-1.4-py3-none-any.whl.

File metadata

  • Download URL: pycalil-1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5

File hashes

Hashes for pycalil-1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 793db8ed78a073bb49be82f673580e99c9bb56f098b408ccc9338d4866464ee6
MD5 63d4ceaa59d410a91b5256d700664c92
BLAKE2b-256 4aef28f3deb8ac0c8db73fc3ce3365c2633a6aacd1470bd84fc5713ed02c0901

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page