{ "info": { "author": "Internet Archive", "author_email": "mek@archive.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 2 - Pre-Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: GNU Affero General Public License v3", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Libraries" ], "description": "openlibrary-client\n==================\n\n![Travis CI build status](https://travis-ci.org/internetarchive/openlibrary-client.svg?branch=master)\n\nA reference client library for the Open Library API. Tested with Python 2.7, 3.5, 3.6.\n\n- [Installation](#installation)\n- [Configuration](#configuration)\n- [Usage](#usage)\n- [Testing](#testing)\n- [Other Client Libraries](#other-client-libraries)\n\n## Installation\n\nAs a prerequisite, openlibrary-client requires libssl-dev for the cryptography used in openssl. for Ubuntu kindly use the following command:\n\n```\n$ sudo apt install libssl-dev\n```\n\nFor Fedora/RHEL, use the following command to install libssl-dev for crypptography used in openssl.\n```\n$ sudo dnf install openssl-dev\n```\n\nIf you plan on doing MARC parsing, you'll need `yaz` (see: https://github.com/indexdata/yaz). Assuming Ubuntu/debian, you can install `yaz` via apt:\n\n```\n$ sudo apt install yaz\n```\n\nFor Fedora/RHEL, use the following command to install `yaz`\n```\n$ sudo dnf install yaz\n```\n\nYou'll also need python dev tools:\n\n```\n$ sudo apt install python-dev # for python 2\n$ sudo apt install python3-dev # for python 3\n```\n\nFor Fedora/RHEL, use:\n```\n$ sudo dnf install python2-devel # for python2.x installs\n$ sudo dnf install python3-devel # for python3.x installs\n```\n\n\nTo install the openlibrary-client package:\n```\n$ git clone https://github.com/internetarchive/openlibrary-client.git\n$ cd openlibrary-client\n$ pip install .\n```\n\n## Configuration\n\nMany Open Library actions (like creating Works and Editions) require authentication, i.e. certain requests must be provided a valid cookie of a user which has been logged in with their openlibrary account credentials. The openlibrary-client can be configured to \"remember you\" so you don't have to provide credentials with each request.\n\nFirst time users may run the following command to enable the \"remember me\" feature. This process will ask for an **Archive.org email and password**, will authenticate the credentials, and then store the account's corresponding s3 keys in `~/.config/ol.ini` (or whichever config location the user has specified):\n\n```\n$ ol --configure --email mek@archive.org\npassword: ***********\nSuccessfully configured\n```\n\n## Usage\n\n### Python Library\n\nFor more examples, you can take a look at our [examples directory](examples/scripts) on Python Scripts for specific use cases that are needed.\n\n#### Adding a new Book\n\nFun things you can do to add a new book to Open Library\n```python\n>>> from olclient.openlibrary import OpenLibrary\n>>> import olclient.common as common\n>>> ol = OpenLibrary()\n>>> book = common.Book(title=u\"Warlight: A novel\", authors=[common.Author(name=u\"Michael Ondaatje\")], publisher=u\"Deckle Edge\", publish_date=u\"2018\")\n>>> book.add_id(u'isbn_10', u'0525521194')\n>>> book.add_id(u'isbn_13', u'978-0525521198')\n>>> new_book = ol.create_book(book)\n>>> new_book.add_bookcover('https://images-na.ssl-images-amazon.com/images/I/51kmM%2BvVRJL._SX337_BO1,204,203,200_.jpg')\n```\n\n#### Works\n\nFun things you can do with an Work:\n\n```python\n>>> from olclient.openlibrary import OpenLibrary\n>>> ol = OpenLibrary()\n>>> work = ol.Work.get(u'OL12938932W')\n>>> editions = work.editions\n```\nOne thing to consider in the snippet above is that work.editions is a @property which makes several http requests to OpenLibrary in order to populate results. Once a call has been made to work.editions, its editions are saved/cached as work._editions.\n\n#### Editions\n\nFun things you can do with an Edition:\n```\n>>> from olclient.openlibrary import OpenLibrary\n>>> ol = OpenLibrary()\n>>> edition = ol.Edition.get(u'OL25952968M')\n>>> authors = edition.authors\n>>> work = edition.work\n>>> work.add_bookcover(u'https://covers.openlibrary.org/b/id/7451891-L.jpg')\n>>> edition.add_bookcover(u'https://covers.openlibrary.org/b/id/7451891-L.jpg')\n```\n\n### Command Line Tool\n\nInstalling the openlibrary-client library will also install the `ol` command line utility. Right now it does exactly nothing.\n\n```\n $ ol\n\nusage: ol [-h] [-v] [--configure] [--get-work] [--get-book] [--get-olid]\n [--olid OLID] [--isbn ISBN] [--create CREATE] [--title TITLE]\n [--baseurl BASEURL] [--email EMAIL]\n\nolclient\n\noptional arguments:\n -h, --help show this help message and exit\n -v Displays the currently installed version of ol\n --configure Configure ol client with credentials\n --get-work Get a work by --title, --olid\n --get-book Get a book by --isbn, --olid\n --get-olid Get an olid by --title or --isbn\n --olid OLID Specify an olid as an argument\n --isbn ISBN Specify an isbn as an argument\n --create CREATE Create a new work from json\n --title TITLE Specify a title as an argument\n --baseurl BASEURL Which OL backend to use\n --email EMAIL An IA email for requests which require authentication.\n You will be prompted discretely for a password\n```\n\nYou can create a new work from the command line using the following syntax. It's almost identical to the olclient.common.Book object construction, except instead of providing an Author object, you instead pass a key for \"author\" and a corresponding value:\n\n```\n> ol --create '{\"title\": \"The Cartoon Guide to Calculus\", \"publisher\": \"Teach Yourself\", \"publish_date\": \"2013\", \"identifiers\": {\"isbn_10\": [\"144419111X\"]}, \"cover\": \"https://images-na.ssl-images-amazon.com/images/I/51aJdEGttLL._SX328_BO1,204,203,200_.jpg\", \"author\": \"Hugh Neill\"}'\nOL26194598M\n```\n\nSuccessful creation of a new Work results in the return of its Open Library edition ID.\n\n## Testing\n\nTo run test cases (from the openlibrary-client directory):\n\n```\n$ py.test tests/\n```\n\n## Other Client Libraries\n\nOther Open Library client libraries include:\n- Ruby: https://github.com/jayfajardo/openlibrary\n- Javascript: https://github.com/onaclovtech/openlibrary\n- Python: https://github.com/felipeborges/python-openlibrary and https://github.com/the-metalgamer/python-openlibrary-client\n- PHP: https://github.com/beezus/openlibrary-php\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/ArchiveLabs/openlibrary-client", "keywords": "", "license": "LICENSE", "maintainer": "", "maintainer_email": "", "name": "openlibrary-client", "package_url": "https://pypi.org/project/openlibrary-client/", "platform": "any", "project_url": "https://pypi.org/project/openlibrary-client/", "project_urls": { "Homepage": "https://github.com/ArchiveLabs/openlibrary-client" }, "release_url": "https://pypi.org/project/openlibrary-client/0.0.18/", "requires_dist": [ "cffi (==1.8.2)", "cryptography (==2.2.0)", "enum34 (==1.1.6)", "idna (==2.7)", "ipaddress (==1.0.16)", "ndg-httpsclient (==0.4.2)", "pyasn1 (==0.1.9)", "pycparser (==2.14)", "pymarc (==3.1.5)", "pyOpenSSL (==16.2.0)", "requests (==2.19.1)", "six (==1.10.0)", "jsonpickle (==0.9.3)", "jsonschema (==2.6.0)", "internetarchive (==1.7.3)", "argparse; python_version==\"2.7\"", "backoff (==1.3.1)" ], "requires_python": "", "summary": "A python client for Open Library", "version": "0.0.18" }, "last_serial": 4040185, "releases": { "0.0.1": [], "0.0.11": [ { "comment_text": "", "digests": { "md5": "347edd100f80a46c3946bb807bb2f2d8", "sha256": "72dfe464814ccc940564dd8d085f8919627d1c5c6b8f6f3b25198b8001e41ad5" }, "downloads": -1, "filename": "openlibrary-client-0.0.11.tar.gz", "has_sig": false, "md5_digest": "347edd100f80a46c3946bb807bb2f2d8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18260, "upload_time": "2016-10-19T04:19:52", "url": "https://files.pythonhosted.org/packages/7b/bb/610a7a3089216252543d95c6d9c2938d2af8899c343ef9670f579071b771/openlibrary-client-0.0.11.tar.gz" } ], "0.0.12": [ { "comment_text": "", "digests": { "md5": "8fa490e74577841669f8667c93a1042c", "sha256": "63ae09ef45df4d910354aaaeaefa07c9ae68ed48c3b14ed85ff3dc1d17bb4dab" }, "downloads": -1, "filename": "openlibrary-client-0.0.12.tar.gz", "has_sig": false, "md5_digest": "8fa490e74577841669f8667c93a1042c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 18259, "upload_time": "2016-10-28T08:15:44", "url": "https://files.pythonhosted.org/packages/6e/31/19cf05ad9471bd04f0d01e967548c248abaaafda5aecf77614f9683a4c13/openlibrary-client-0.0.12.tar.gz" } ], "0.0.13": [ { "comment_text": "", "digests": { "md5": "e703a4fa7960ccdf8a12e347a75311d1", "sha256": "6b5910a4e5c684307f75dd9cf1f38f3fe156ec8129c15368b0118f50ac20129a" }, "downloads": -1, "filename": "openlibrary-client-0.0.13.tar.gz", "has_sig": false, "md5_digest": "e703a4fa7960ccdf8a12e347a75311d1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19077, "upload_time": "2016-10-28T09:04:10", "url": "https://files.pythonhosted.org/packages/40/0e/3b277d1febd6e3f1efa2dc9a3efc5e8fe615483aa5c6677f3d87bee51114/openlibrary-client-0.0.13.tar.gz" } ], "0.0.14": [ { "comment_text": "", "digests": { "md5": "0a2ba7a9efb925a4bdee98cb9ad97313", "sha256": "0c1cb0f8b523fd4816e7dd48e0b37f8b5baf52e082677498affc0aeab6362cb9" }, "downloads": -1, "filename": "openlibrary-client-0.0.14.tar.gz", "has_sig": false, "md5_digest": "0a2ba7a9efb925a4bdee98cb9ad97313", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19251, "upload_time": "2016-10-28T09:15:31", "url": "https://files.pythonhosted.org/packages/f3/0f/9e9da259ac928a7f4a73b9ca4ab76977f1f79dd14a8783dad556865ac3a1/openlibrary-client-0.0.14.tar.gz" } ], "0.0.16": [ { "comment_text": "", "digests": { "md5": "3c1a53ec25b29037f86dc5dcd00bd78b", "sha256": "b584301a9b4d262541abccaccea27730f93c5a4c65a3d3fb9419cbb9dce7b107" }, "downloads": -1, "filename": "openlibrary-client-0.0.16.tar.gz", "has_sig": false, "md5_digest": "3c1a53ec25b29037f86dc5dcd00bd78b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19801, "upload_time": "2017-07-13T21:20:36", "url": "https://files.pythonhosted.org/packages/59/6b/d66ea247dfdc6f3389c5c199515edfaa2385406b0afdb33a40a827361bef/openlibrary-client-0.0.16.tar.gz" } ], "0.0.17": [ { "comment_text": "", "digests": { "md5": "f150ea32c742b1d5578e59715f8c93a0", "sha256": "2d7dfa00b7307b5a5f6e1b713792f2f6122fbdbd42bd85612f48bef64a3c0cf9" }, "downloads": -1, "filename": "openlibrary-client-0.0.17.tar.gz", "has_sig": false, "md5_digest": "f150ea32c742b1d5578e59715f8c93a0", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19772, "upload_time": "2017-10-06T03:35:06", "url": "https://files.pythonhosted.org/packages/2c/0c/536dddb56cb6610250fe1827efa9bb1b6df2b7544c42b29793f83fa9fac2/openlibrary-client-0.0.17.tar.gz" } ], "0.0.18": [ { "comment_text": "", "digests": { "md5": "55548f006aff0782fc7be16a1e19b1d7", "sha256": "c1e313f11332ead5d0878efb04c2db50fb2ec693a410f29bbff8038cea2a2f8c" }, "downloads": -1, "filename": "openlibrary_client-0.0.18-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "55548f006aff0782fc7be16a1e19b1d7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 25998, "upload_time": "2018-07-08T08:38:48", "url": "https://files.pythonhosted.org/packages/df/77/91f8157e032e9e55f62e29c7150c817da1f41e9a6707f3c88ea4db5c0959/openlibrary_client-0.0.18-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "de14e9871b183f5379712859b47ace5f", "sha256": "a56dcabae5bbdca2620f80375d9b5958b47dbca3cc12e51bbdaa7b1cca9f6fdc" }, "downloads": -1, "filename": "openlibrary-client-0.0.18.tar.gz", "has_sig": false, "md5_digest": "de14e9871b183f5379712859b47ace5f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22197, "upload_time": "2018-07-08T08:38:50", "url": "https://files.pythonhosted.org/packages/3f/b1/b28928949d11d209398ae8e89314133d573fc0c3aafb15c7f84540c983e2/openlibrary-client-0.0.18.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "55548f006aff0782fc7be16a1e19b1d7", "sha256": "c1e313f11332ead5d0878efb04c2db50fb2ec693a410f29bbff8038cea2a2f8c" }, "downloads": -1, "filename": "openlibrary_client-0.0.18-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "55548f006aff0782fc7be16a1e19b1d7", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 25998, "upload_time": "2018-07-08T08:38:48", "url": "https://files.pythonhosted.org/packages/df/77/91f8157e032e9e55f62e29c7150c817da1f41e9a6707f3c88ea4db5c0959/openlibrary_client-0.0.18-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "de14e9871b183f5379712859b47ace5f", "sha256": "a56dcabae5bbdca2620f80375d9b5958b47dbca3cc12e51bbdaa7b1cca9f6fdc" }, "downloads": -1, "filename": "openlibrary-client-0.0.18.tar.gz", "has_sig": false, "md5_digest": "de14e9871b183f5379712859b47ace5f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 22197, "upload_time": "2018-07-08T08:38:50", "url": "https://files.pythonhosted.org/packages/3f/b1/b28928949d11d209398ae8e89314133d573fc0c3aafb15c7f84540c983e2/openlibrary-client-0.0.18.tar.gz" } ] }