Skip to main content

Python SDK for the NLB Open Web Services

Project description

Build Status codecov PyPI Documentation Status

nlbsg

Python SDK for the NLB Open Web Services

Currently supports the Catalogue Service.

Installation

pip install nlbsg

Example usage

Creating a client:

from nlbsg import Client

WSDL = 'https://openweb-stg.nlb.gov.sg/OWS/CatalogueService.svc?singleWsdl'
API_KEY = 'secret_api_key'

client = Client(WSDL, API_KEY)

Searching the catalogue:

>>> from nlbsg import MediaCode
>>> results = client.search('lord of the rings', author='tolkien', media_code=MediaCode.BOOKS, limit=3)
>>> for title in results.titles:
...     print(f'Title: {title.title_name}\nISBN: {title.isbn}\nPublished: {title.publish_year}\n')
...
Title: Beren and Lúthien / by  J.R.R. Tolkien ; edited by Christopher Tolkien ; with illustrations by  Alan Lee.
ISBN: 1328915336 (paperback)
Published: 2018

Title: Beren and l℗♭©ʻthien [electronic resource]. J. R. R Tolkien.
ISBN: 9780008214210 (electronic bk)
Published: 2017

Title: The fall of arthur [electronic resource]. J. R. R Tolkien.
ISBN: 9780007489954 (electronic bk)
Published: 2013

Getting title details:

>>> details = client.get_title_details(isbn='1328915336')
>>> details.title_detail.summary
"The epic tale of Beren and Lúthien became an essential element in the evolution of The Silmarillion, the myths and legends of J.R.R. Tolkien's First Age of the World. Always key to the story is the fate that shadowed their love: Beren was a mortal man, Lúthien an immortal Elf. Her father, a great Elvish lord, imposed on Beren an impossible task before he might wed Lúthien: to rob the greatest of all evil beings, Melkor, of a Silmaril.Painstakingly restored from Tolkien's manuscripts and presented for the first time as a continuous and standalone story, Beren and Lúthien reunites fans of The Hobbit and The Lord of the Rings with Elves and Men, along with the rich landscape and creatures unique to Tolkien's Middle-earth. Christopher Tolkien tells the story in his father's own words by giving its original form as well as prose and verse passages from later texts that illustrate the narrative as it changed. -- from back cover."

Getting title availability:

>>> availability = client.get_availability_info(isbn='1328915336')
>>> for item in availability.items:
...     print(f'Branch: {item.branch_name}\nStatus: {item.status_desc}\n')
...
Branch: Ang Mo Kio Public Library
Status: Not On Loan

Branch: Bukit Batok Public Library
Status: On Loan

Branch: Bedok Public Library
Status: On Loan

Branch: Bishan Public Library
Status: Not On Loan

Branch: Bukit Panjang Public Library
Status: Not On Loan

Branch: Choa Chu Kang Public Library
Status: On Loan

Branch: Central Public Library
Status: Not On Loan

Branch: Clementi Public Library
Status: On Loan

Branch: Cheng San Public Library
Status: On Loan

Branch: Geylang East Public Library
Status: Not On Loan

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

nlbsg-0.3.5.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nlbsg-0.3.5-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file nlbsg-0.3.5.tar.gz.

File metadata

  • Download URL: nlbsg-0.3.5.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for nlbsg-0.3.5.tar.gz
Algorithm Hash digest
SHA256 fb3f6f05950d6dd2ea5d30f0f870dfcf980bb766791114e7e34438a2934c6f62
MD5 f56a125099e10b4dd041b529a2db5b6c
BLAKE2b-256 1183d26b57c3ef124adf063e2318448856dab32c7fe06414733d55d2719f461a

See more details on using hashes here.

File details

Details for the file nlbsg-0.3.5-py3-none-any.whl.

File metadata

  • Download URL: nlbsg-0.3.5-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

File hashes

Hashes for nlbsg-0.3.5-py3-none-any.whl
Algorithm Hash digest
SHA256 0308f7b37943ac8dd60515e8f21e159a44fff4a9d648efb0a2e72a9f47da35de
MD5 6d2044f6f51663b3b76398e1457a0271
BLAKE2b-256 08ed5c0d1cb0e7e8453149b6d764a7a57b579a1575200239292743afbf12b886

See more details on using hashes here.

Supported by

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