{"id":21479287,"url":"https://github.com/rycus86/ghost-client","last_synced_at":"2025-08-21T06:31:05.415Z","repository":{"id":41579823,"uuid":"115763216","full_name":"rycus86/ghost-client","owner":"rycus86","description":"Unofficial Ghost API client","archived":false,"fork":false,"pushed_at":"2024-06-19T01:08:18.000Z","size":45,"stargazers_count":20,"open_issues_count":1,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-06T22:18:26.752Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rycus86.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-12-30T00:22:48.000Z","updated_at":"2024-09-27T08:04:24.000Z","dependencies_parsed_at":"2024-11-23T11:25:31.853Z","dependency_job_id":"c27165e6-e5a2-462d-8b4f-7c1fc571db34","html_url":"https://github.com/rycus86/ghost-client","commit_stats":{"total_commits":25,"total_committers":3,"mean_commits":8.333333333333334,"dds":0.12,"last_synced_commit":"4d032480076d65739ffbd65db6b9768ecb1c0731"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rycus86%2Fghost-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rycus86%2Fghost-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rycus86%2Fghost-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rycus86%2Fghost-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rycus86","download_url":"https://codeload.github.com/rycus86/ghost-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230494921,"owners_count":18235046,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-23T11:24:30.795Z","updated_at":"2024-12-19T20:08:28.312Z","avatar_url":"https://github.com/rycus86.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 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    admin_key=='admin API key'\n)\n\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 \u0026 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 \u0026 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```\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\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frycus86%2Fghost-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frycus86%2Fghost-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frycus86%2Fghost-client/lists"}