{ "info": { "author": "Viktor Adam", "author_email": "rycus86@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries" ], "description": "# Unofficial Ghost API client\n\n[![Travis](https://img.shields.io/travis/rycus86/ghost-client.svg)](https://travis-ci.org/rycus86/ghost-client)\n[![PyPI](https://img.shields.io/pypi/v/ghost-client.svg)](https://pypi.python.org/pypi/ghost-client)\n[![PyPI](https://img.shields.io/pypi/pyversions/ghost-client.svg)](https://pypi.python.org/pypi/ghost-client)\n[![Coverage Status](https://coveralls.io/repos/github/rycus86/ghost-client/badge.svg?branch=master)](https://coveralls.io/github/rycus86/ghost-client?branch=master)\n[![Maintainability](https://api.codeclimate.com/v1/badges/45f2a5020caa37777f5a/maintainability)](https://codeclimate.com/github/rycus86/ghost-client/maintainability)\n\nThis is a client library for the [Ghost blogging platform API](https://api.ghost.org).\n\n## Installation\n\n```shell\n$ pip install ghost-client\n```\n\n## Usage\n\nSee [https://api.ghost.org](https://api.ghost.org/) for documentation on the REST endpoints and available fields and parameters.\n\n```python\nfrom ghost_client import Ghost\n\n# to read the client ID and secret from the database\nghost = Ghost.from_sqlite(\n '/var/lib/ghost/content/data/ghost.db',\n 'http://localhost:2368'\n)\n\n# or to use a specific client ID and secret\nghost = Ghost(\n 'http://localhost:2368',\n client_id='ghost-admin', client_secret='secret_key'\n)\n\n# log in\nghost.login('username', 'password')\n\n# print the server's version\nprint(ghost.version)\n\n# create a new tag\ntag = ghost.tags.create(name='API sample')\n\n# create a new post using it\npost = ghost.posts.create(\n title='Example post', slug='custom-slug',\n markdown='', # yes, even on v1.+\n custom_excerpt='An example post created from Python',\n tags=[tag]\n)\n\n# list posts, tags and users\nposts = ghost.posts.list(\n status='all',\n fields=('id', 'title', 'slug'),\n formats=('html', 'mobiledoc', 'plaintext'),\n)\ntags = ghost.tags.list(fields='name', limit='all')\nusers = ghost.users.list(include='count.posts')\n\n# use pagination\nwhile posts:\n for post in posts:\n print(post)\n posts = posts.next_page()\n\nprint(posts.total)\nprint(posts.pages)\n\n# update a post & tag\nupdated_post = ghost.posts.update(post.id, title='Updated title')\nupdated_tag = ghost.tags.update(tag.id, name='Updated tag')\n\n# note: creating, updating and deleting a user is not allowed by the API\n\n# access fields as properties\nprint(post.title)\nprint(post.markdown) # needs formats='mobiledoc'\nprint(post.author.name) # needs include='author'\n\n# delete a post & tag\nghost.posts.delete(post.id)\nghost.tags.delete(tag.id)\n\n# upload an image\nghost.upload(file_obj=open('sample.png', 'rb'))\nghost.upload(file_path='/path/to/image.jpeg', 'rb')\nghost.upload(name='image.gif', data=open('local.gif', 'rb').read())\n\n# log out\nghost.logout()\n```\n\nThe logged in credentials will be saved in memory and on HTTP 401 errors the client will attempt to re-authenticate once automatically.\n\nResponses are wrapped in `models.ModelList` and `models.Model` types to allow pagination and retrieving fields as properties.\n\n## License\n\nMIT", "description_content_type": "", "docs_url": null, "download_url": "https://github.com/rycus86/ghost-client/archive/0.0.4.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/rycus86/ghost-client", "keywords": "ghost,blog,api,client", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "ghost-client", "package_url": "https://pypi.org/project/ghost-client/", "platform": "", "project_url": "https://pypi.org/project/ghost-client/", "project_urls": { "Download": "https://github.com/rycus86/ghost-client/archive/0.0.4.tar.gz", "Homepage": "https://github.com/rycus86/ghost-client" }, "release_url": "https://pypi.org/project/ghost-client/0.0.4/", "requires_dist": null, "requires_python": "", "summary": "API client for the Ghost blogging platform", "version": "0.0.4" }, "last_serial": 3678643, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "234de6735c82971ed526c13df865dae6", "sha256": "73794c6ff2738462f416dc1b054c1bfb28e7e3aa006641cffe9cea2a9a3a3909" }, "downloads": -1, "filename": "ghost_client-0.0.1.tar.gz", "has_sig": false, "md5_digest": "234de6735c82971ed526c13df865dae6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6268, "upload_time": "2018-01-07T00:11:41", "url": "https://files.pythonhosted.org/packages/27/52/7a3a94b4f747c9b510a88b7e6d2aa357d2310c522a904d17553f6f7ea9bd/ghost_client-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "52d13736ab634690281856776119fef2", "sha256": "507a5771461d629cad7abb93bc22a6d58db5159bcd85fb4976702fc8c23e137c" }, "downloads": -1, "filename": "ghost_client-0.0.2.tar.gz", "has_sig": false, "md5_digest": "52d13736ab634690281856776119fef2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6347, "upload_time": "2018-01-07T00:25:14", "url": "https://files.pythonhosted.org/packages/c5/9a/f8bc72bbb6c290a274c50d07da7942a1955c17a725cbafc0d5198e4ec3e2/ghost_client-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "cc337264dc7eca2c457addb61d80a7a7", "sha256": "863030f0aa243f9af7f1868f6d249a67292ee0ea9f7066e30fab30f5c0037331" }, "downloads": -1, "filename": "ghost_client-0.0.3.tar.gz", "has_sig": false, "md5_digest": "cc337264dc7eca2c457addb61d80a7a7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6871, "upload_time": "2018-02-13T22:31:39", "url": "https://files.pythonhosted.org/packages/73/b5/68ae202f514bd8ff7665fa440d62149bd43d8014e5786cfaae34a72329ae/ghost_client-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "cb894ad1a0bc1c94bf2ec093e59d0fc3", "sha256": "f019e08926aa02223d01eaa0492295428e76eabc26e23ac5c795b55c2e70731b" }, "downloads": -1, "filename": "ghost_client-0.0.4.tar.gz", "has_sig": false, "md5_digest": "cb894ad1a0bc1c94bf2ec093e59d0fc3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7190, "upload_time": "2018-03-17T11:22:43", "url": "https://files.pythonhosted.org/packages/7d/75/0a20cfa61f8eb21fea7b470f0691231ba9be9c031de9ac452f9f28917c60/ghost_client-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "cb894ad1a0bc1c94bf2ec093e59d0fc3", "sha256": "f019e08926aa02223d01eaa0492295428e76eabc26e23ac5c795b55c2e70731b" }, "downloads": -1, "filename": "ghost_client-0.0.4.tar.gz", "has_sig": false, "md5_digest": "cb894ad1a0bc1c94bf2ec093e59d0fc3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7190, "upload_time": "2018-03-17T11:22:43", "url": "https://files.pythonhosted.org/packages/7d/75/0a20cfa61f8eb21fea7b470f0691231ba9be9c031de9ac452f9f28917c60/ghost_client-0.0.4.tar.gz" } ] }