Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

API client for the Ghost blogging platform

Project Description

# Unofficial Ghost API client

[![Coverage Status](](

This is a client library for the [Ghost blogging platform API](

## Installation

$ pip install ghost-client

## Usage

See []( for documentation on the REST endpoints and available fields and parameters.

from ghost_client import Ghost

# to read the client ID and secret from the database
ghost = Ghost.from_sqlite(

# or to use a specific client ID and secret
ghost = Ghost(
client_id='ghost-admin', client_secret='secret_key'

# log in
ghost.login('username', 'password')

# print the server's version

# create a new tag
tag = ghost.tags.create(name='API sample')

# create a new post using it
post = ghost.posts.create(
title='Example post', slug='custom-slug',
markdown='', # yes, even on v1.+
custom_excerpt='An example post created from Python',

# list posts, tags and users
posts = ghost.posts.list(
fields=('id', 'title', 'slug'),
formats=('html', 'mobiledoc', 'plaintext'),
tags = ghost.tags.list(fields='name', limit='all')
users = ghost.users.list(include='count.posts')

# use pagination
while posts:
for post in posts:
posts = posts.next_page()


# update a post & tag
updated_post = ghost.posts.update(, title='Updated title')
updated_tag = ghost.tags.update(, name='Updated tag')

# note: creating, updating and deleting a user is not allowed by the API

# access fields as properties
print(post.markdown) # needs formats='mobiledoc'
print( # needs include='author'

# delete a post & tag

# upload an image
ghost.upload(file_obj=open('sample.png', 'rb'))
ghost.upload(file_path='/path/to/image.jpeg', 'rb')
ghost.upload(name='image.gif', data=open('local.gif', 'rb').read())

# log out

The logged in credentials will be saved in memory and on HTTP 401 errors the client will attempt to re-authenticate once automatically.

Responses are wrapped in `models.ModelList` and `models.Model` types to allow pagination and retrieving fields as properties.

## License


Release History

This version
History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(6.9 kB) Copy SHA256 Hash SHA256
Source None Feb 13, 2018

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting