-
Notifications
You must be signed in to change notification settings - Fork 105
Edition
Salman Shah edited this page Jul 10, 2018
·
1 revision
Creates this book as an Edition associated with the work having olid work_olid
>>> from olclient import OpenLibrary
>>> ol = OpenLibrary()
>>> = ol.Edition.create(Book(...), u'OL2514725W')Creates a Book Object using the JSON that is input
import json
data = json.dumps({"title":"XXX", "authors":["XXX","XXX"], "publisher":"XXX", "publish_date":"XXX"})>>> from olclient import OpenLibrary
>>> ol = OpenLibrary()
>>> = ol.Edition.json_to_book(data)Method is still not done properly. Related Issue
Creates Book Arguments from OL Edition JSON
import json
json = {"edition_olid":"XXX", "authors":["XXX","XXX"], "work_olid":"XXX"}>>> from olclient import OpenLibrary
>>> ol = OpenLibrary()
>>> = ol.Edition._ol_edition_json_to_book_args(data)Retrieves a single book from OpenLibrary as json by isbn or olid or ociad or lccn or oclc or olid.
>>> from olclient import OpenLibrary
>>> ol = OpenLibrary()
>>> ol.Edition.get(olid=u'OL25944230M')>>> from olclient import OpenLibrary
>>> ol = OpenLibrary()
>>> ol.Edition.get(isbn=u'9706664998')>>> from olclient import OpenLibrary
>>> ol = OpenLibrary()
>>> ol.Edition.get(oclc=u'893562252')>>> from olclient import OpenLibrary
>>> ol = OpenLibrary()
>>> ol.Edition.get(lccn=u'XXX')>>> from olclient import OpenLibrary
>>> ol = OpenLibrary()
>>> ol.Edition.get(ocaid=u'XXX')Looks up a key (LCCN, OCLC, ISBN10/13, OCAID) in OpenLibrary and returns a matching olid if a match exists.
>>> from olclient import OpenLibrary
>>> ol = OpenLibrary()
>>> ol.Edition.get_metadata(u'ISBN', u'9780747550303')>>> from olclient import OpenLibrary
>>> ol = OpenLibrary()
>>> ol.Edition.get_metadata(u'LCCN', u'XXX')>>> from olclient import OpenLibrary
>>> ol = OpenLibrary()
>>> ol.Edition.get_metadata(u'OCLC', u'XXX')>>> from olclient import OpenLibrary
>>> ol = OpenLibrary()
>>> ol.Edition.get_metadata(u'OCAID', u'XXX')Please ensure you have a bot account to run this.
>>> from olclient.openlibrary import OpenLibrary
>>> ol = OpenLibrary()
>>> edition = ol.Edition.get(u'OL25952968M')
>>> authors = edition.authors
>>> work = edition.work
>>> work.add_bookcover(u'https://covers.openlibrary.org/b/id/7451891-L.jpg')
>>> edition.add_bookcover(u'https://covers.openlibrary.org/b/id/7451891-L.jpg')