{ "info": { "author": "MyBook", "author_email": "dev@mybook.ru", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "Litres API\n==========\n\npython-\u043e\u0431\u0451\u0440\u0442\u043a\u0430 \u0432\u043e\u043a\u0440\u0443\u0433 API \u041b\u0438\u0442\u0420\u0435\u0441 \u043d\u0430 \u0431\u0430\u0437\u0435 requests \u0438 xmltodict\n\n.. image:: https://img.shields.io/badge/python-2.7,%203.4,%203.5-blue.svg\n :target: https://pypi.python.org/pypi/litresapi/\n.. image:: https://travis-ci.org/MyBook/litresapi.svg?branch=master\n :target: https://travis-ci.org/MyBook/litresapi\n.. image:: https://codecov.io/gh/MyBook/litresapi/branch/master/graph/badge.svg\n :target: https://codecov.io/gh/MyBook/litresapi\n.. image:: https://img.shields.io/badge/docs-1.83-orange.svg\n :alt: Docs version\n :target: http://www.litres.ru/static/get_fresh_book.zip\n\n`\u041e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f XML API `__\n\n\u041f\u0440\u0438\u043c\u0435\u0440\u044b\n~~~~~~~\n\n\u041f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u043d\u0438\u0433\n------------------------\n\n.. code:: python\n\n from litresapi import LitresApi\n\n api = LitresApi(secret_key='your-secret-key', partner_id='ZZZZ')\n lazy_books = api.get_fresh_book(start_date=datetime.datetime(2015, 7, 19, 12, 5))\n\n >>> first_book = next(lazy_books)\n >>> print(json.dumps(first_book, indent=4, ensure_ascii=False))\n {\n \"title-info\": {\n \"genre\": \"detective\",\n \"author\": {\n \"first-name\": \"\u0415\u0432\u0433\u0435\u043d\u0438\u0439\",\n \"middle-name\": \"\u0415\u0432\u0433\u0435\u043d\u044c\u0435\u0432\u0438\u0447\",\n \"last-name\": \"\u0421\u0443\u0445\u043e\u0432\",\n \"id\": \"1212f327-2a83-102a-9ae1-2dfe723fe7c7\"\n },\n ...\n }\n ...\n \"@external_id\": \"37828892-1a76-11e5-ad6a-002590591dd6\",\n \"@tag\": \"updated-book\"\n ...\n }\n\n\u0412\u043c\u0435\u0441\u0442\u043e \u0441\u043b\u043e\u0432\u0430\u0440\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 xml \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e (lxml):\n\n.. code:: python\n\n api = LitresApi(secret_key='your-secret-key, partner_id='ZZZZ', xml=True)\n lazy_books = api.get_fresh_book(start_date=datetime.datetime(2015, 7, 19, 12, 5))\n\n >>> book = next(lazy_books)\n \n >>> book.attrib['external_id']\n '37828892-1a76-11e5-ad6a-002590591dd6'\n >>> book.getchildren()\n [, , ...]\n\n\u041c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0430\u0432\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u044b \u0434\u043b\u044f \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438 \u043e\u0442\u0432\u0435\u0442\u0430 \u043d\u0430 \u0431\u0430\u0437\u0435 requests hooks:\n\n.. code:: python\n\n def save_xml_to_file(response, *args, **kwargs):\n with open('litres_response.xml', 'wb') as fl:\n fl.write(response.content)\n\n >> api.get_fresh_book(start_date=datetime.datetime(2015, 7, 19, 12, 5),\n hooks={'response': save_xml_to_file})\n\n\n\u041e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f\n+++++++++++\n\n- ``api.get_fresh_book`` \u043d\u0435\u043b\u044c\u0437\u044f \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0447\u0430\u0449\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0430 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443\n- \u0432\u0440\u0435\u043c\u044f \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043e \u0432\u0435\u0440\u043d\u043e, \u0438\u043d\u0430\u0447\u0435 ``timestamp`` \u0437\u0430\u043f\u0440\u043e\u0441\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u0432\u0435\u0440\u0433\u043d\u0443\u0442\n\n\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u043a\u043d\u0438\u0433\u0443\n-------------\n.. code:: python\n\n response = api.get_the_book(external_id='37828892-1a76-11e5-ad6a-002590591dd6')\n >>> response\n \n >>> response.headers['Content-Disposition']\n 'attachment; filename=\"Suhov_E._Rassledovaniya._Brosok_Na_Vyistrel.fb2.zip\"'\n >>> len(response.content)\n 452166\n\n\u0421\u043a\u0430\u0447\u0430\u0442\u044c \u043e\u0431\u043b\u043e\u0436\u043a\u0443\n---------------\n\n.. code:: python\n\n response = api.get_cover(file_id='13299029', file_ext='jpg')\n >>> response\n \n >>> response.headers['Content-Type']\n 'image/jpeg'\n >>> len(response.content)\n 51405\n\n\u0412\u043c\u0435\u0441\u0442\u043e ``file_id`` \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043a\u043d\u0438\u0433\u0438 \u0438\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 ``get_fresh_book``\n\n.. code:: python\n\n book = next(api.get_fresh_book(start_date=datetime.datetime(2015, 7, 19, 12, 5)))\n >>> api.get_cover(book=book).headers['Content-Type']\n 'image/jpeg'\n\n\u0415\u0441\u043b\u0438 \u043e\u0431\u043b\u043e\u0436\u043a\u0438 \u0443 \u043a\u043d\u0438\u0433\u0438 \u043d\u0435\u0442, \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u0435\u0440\u043d\u0451\u0442 ``None``\n\n.. code:: python\n\n book = next(api.get_fresh_book(uuid='ead79f60-4471-4952-aa81-5f126fb6da82'))\n >>> api.get_cover(book=book)\n None\n\n\u0416\u0430\u043d\u0440\u044b\n-----\n\n.. code:: python\n\n genres = api.get_genres()\n >>> print(json.dumps(genres, indent=4, ensure_ascii=False))\n [\n {\n \"@id\": \"5003\",\n \"@title\": \"\u0411\u0438\u0437\u043d\u0435\u0441-\u043a\u043d\u0438\u0433\u0438\",\n \"@type\": \"root\",\n \"genre\": [\n {\n \"@id\": \"5049\",\n \"@title\": \"\u0411\u0430\u043d\u043a\u043e\u0432\u0441\u043a\u043e\u0435 \u0434\u0435\u043b\u043e\",\n \"@token\": \"bankovskoe_delo\",\n \"@type\": \"genre\"\n },\n {\n \"@id\": \"5047\",\n \"@title\": \"\u041a\u0430\u0434\u0440\u043e\u0432\u044b\u0439 \u043c\u0435\u043d\u0435\u0434\u0436\u043c\u0435\u043d\u0442\",\n \"@token\": \"kadrovyj_menedzhment\",\n \"@type\": \"container\",\n \"genre\": [\n {\n \"@id\": \"5334\",\n \"@title\": \"\u0410\u0442\u0442\u0435\u0441\u0442\u0430\u0446\u0438\u044f \u043f\u0435\u0440\u0441\u043e\u043d\u0430\u043b\u0430\",\n \"@token\": \"attestaciya_personala\",\n \"@type\": \"genre\"\n },\n ...\n ]\n\n\u0414\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f xml:\n\n.. code:: python\n\n api = LitresApi(xml=True)\n genres = api.get_genres()\n >>> genres.xpath(\"//genre[@token='sport_fitnes']\")[0].attrib['title']\n '\u0421\u043f\u043e\u0440\u0442, \u0444\u0438\u0442\u043d\u0435\u0441'\n\n\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430\n~~~~~~~~~~\n\n\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u044b\n---------------\n\n::\n\n tox -e py37\n\n\n\u041f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u044f \u0440\u0435\u043b\u0438\u0437\u0430 \u0432 PyPi\n------------------------\n\n\u0414\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0440\u0435\u043b\u0438\u0437\u0430 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f `twine `_.\n\u0414\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e::\n\n pip install twine\n\n1. \u041f\u043e\u0434\u043d\u0438\u043c\u0430\u0435\u043c \u0432\u0435\u0440\u0441\u0438\u044e \u043f\u0430\u043a\u0435\u0442\u0430::\n\n __version__ = '1.0.2'\n\n2. \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0430\u043a\u0435\u0442::\n\n python setup.py sdist\n\n3. \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u043a\u0435\u0442 \u0432 PyPi::\n\n twine upload dist/litresapi-1.0.1.tar.gz\n\n\nChangelog\n---------\n\n1.0.0 (2017-02-25)\n------------------\n* Enable requests hooks for get_fresh_book\n* Fix genres endpoint url\n* Introduce public parse_fresh_book method to decouple fetching from parsing\n* Enforce list for author, genre, sequence to simplify parsing\n* Wrap annotation content to CDATA tag to avoid unparsable xml\n* Better connection error handing\n\n\n0.1.0 (2015-08-01)\n------------------\n\n* First internal release", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/MyBook/litresapi", "keywords": "litresapi", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "litresapi", "package_url": "https://pypi.org/project/litresapi/", "platform": "", "project_url": "https://pypi.org/project/litresapi/", "project_urls": { "Homepage": "https://github.com/MyBook/litresapi" }, "release_url": "https://pypi.org/project/litresapi/1.0.2/", "requires_dist": null, "requires_python": "", "summary": "Litres API", "version": "1.0.2" }, "last_serial": 5461169, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "ea65f50cf9382c1c85600dbc1fe3911b", "sha256": "e991bbef0f06e8621033b5814991660067f08f4051eb770fd3cabd8e6b559c73" }, "downloads": -1, "filename": "litresapi-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "ea65f50cf9382c1c85600dbc1fe3911b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 21137, "upload_time": "2017-02-25T08:44:26", "url": "https://files.pythonhosted.org/packages/2e/7a/3442215ded3d444c0872cb5da070277d801b9b0a92c04f1c9b4b8af04af4/litresapi-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ceaae9f8e12ed778569f2d905001a384", "sha256": "8289d63908f807b577a76f1b3256dc986c5a526a324e6c2aa49892cb152d1337" }, "downloads": -1, "filename": "litresapi-1.0.0.tar.gz", "has_sig": false, "md5_digest": "ceaae9f8e12ed778569f2d905001a384", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 48806, "upload_time": "2017-02-25T08:44:28", "url": "https://files.pythonhosted.org/packages/d4/95/dcc99c62696b2a9f9679cfc39267b6c007c36dfdfdc08efe66d36a6a0be9/litresapi-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "061dbde7a64239df282cabec426b2b2c", "sha256": "67f55f9a03f2b7192cff58fc1007b979023e93561209f5a5adf8ba6ec7c3bb88" }, "downloads": -1, "filename": "litresapi-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "061dbde7a64239df282cabec426b2b2c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 21102, "upload_time": "2017-02-25T15:28:46", "url": "https://files.pythonhosted.org/packages/ed/20/da7529077adf5dc21e8f1ec31b4431cfe374338a347368fb3433e3cd03bc/litresapi-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "9b11fd9a811b071e1b5442d560430d5f", "sha256": "66107795957b1d30150cd2a8a853fa3242c9e0c79bfb189dcc04320932b1251e" }, "downloads": -1, "filename": "litresapi-1.0.1.tar.gz", "has_sig": false, "md5_digest": "9b11fd9a811b071e1b5442d560430d5f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 51398, "upload_time": "2017-02-25T15:28:47", "url": "https://files.pythonhosted.org/packages/37/cc/41d697be335a3013c0094c7e35169cb5bd103e1bc22c964c49e2979ab175/litresapi-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "b587d8eadeded744643a48d235e0192d", "sha256": "d32619ba6a8193ead2000ee5b8602709ef633903181e177294b4f116bdbb41a8" }, "downloads": -1, "filename": "litresapi-1.0.2.tar.gz", "has_sig": false, "md5_digest": "b587d8eadeded744643a48d235e0192d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 51326, "upload_time": "2019-06-28T11:19:16", "url": "https://files.pythonhosted.org/packages/7a/a2/02892360bf8fba521a0add500e57024a0b1eb7d388260866a8e1ca30ebb6/litresapi-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "b587d8eadeded744643a48d235e0192d", "sha256": "d32619ba6a8193ead2000ee5b8602709ef633903181e177294b4f116bdbb41a8" }, "downloads": -1, "filename": "litresapi-1.0.2.tar.gz", "has_sig": false, "md5_digest": "b587d8eadeded744643a48d235e0192d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 51326, "upload_time": "2019-06-28T11:19:16", "url": "https://files.pythonhosted.org/packages/7a/a2/02892360bf8fba521a0add500e57024a0b1eb7d388260866a8e1ca30ebb6/litresapi-1.0.2.tar.gz" } ] }