EDWH Ghost Client
This Client is compatible with v3, v4, v5 and v6 of the Ghost CMS Admin and Content API's.
Installation
pip install edwh-ghost
Usage
The GhostAdmin class can be instantiated as follows:
from ghost import GhostAdmin
from dotenv import dotenv_values
config = dotenv_values(".env")
# .env can be used, but config values can also be simply hardcoded
ga = GhostAdmin(
config["GHOST_SITE"],
adminAPIKey=config["GHOST_ADMIN_KEY"],
contentAPIKey=config["GHOST_CONTENT_KEY"],
api_version="v4", # works like a train
)
print(ga.site())
If no admin API key is available, the GhostContent class can be used, which has read-only access to public endpoints.
After creating a GhostClient instance, the different Resources can be used:
from ghost.resources import *
posts: PostResource = ga.posts
# READ
multiple = posts(limit=5) # Ghost Result Set
# alias for
posts.get(limit=5) # Ghost Result Set
some_post = posts.get("some_id") # Ghost Result
for post in posts.paginate():
# iterate without limit
print(post) # Ghost Result
# UPDATE
some_post.update({...}) # response dict
# alias:
posts.update("some_id", {...}) # response dict
# bulk:
multiple.update({...}) # response dict
# DELETE
some_post.delete() # bool of success
# alias:
posts.delete("some_id") # bool of success
# bulk:
multiple.delete() # list of bools of success
# CREATE
# one:
posts.create(title="...", etc="...") # response dict
# bulk:
posts.create({...}, {...}) # list of response dicts
# some resources are read only:
authors: AuthorResource = ga.authors
authors() # Ghost Result Set
authors.delete() # error
Available Resources:
| Resource Class1 | Ghost Path | Method2 | Related Tests | Admin? | Content? |
|---|---|---|---|---|---|
| Posts | /posts | ghost.posts(), ghost.post() | test_1_posts, test_10_ghost_content, test_11_ghost_paginate | ✓ | ✓ |
| Pages | /pages | ghost.pages(), ghost.page() | test_2_pages | ✓ | ✓ |
| Authors | /authors | ghost.authors(), ghost.author() | test_4_authors | ~3 | ✓ |
| Tags | /tags | ghost.tags(), ghost.tag() | test_3_tags | ✓ | ✓ |
| Members | /members | ghost.members(), ghost.member() | test_9_members | ✓ | ✗ |
| Images | /images | ghost.images.upload() | test_6_images | ✓ | ✗ |
| Themes | /themes | ghost.themes.upload(), ghost.themes.activate() | test_7_themes | ✓ | ✗ |
| Site | /site | ghost.site() | test_8_site_and_settings | ✓ | ✗ |
| Settings | /settings | ghost.settings() | test_8_site_and_settings | ~3 | ✓ |
| Users | /users | ghost.user(), ghost.users() | test_12_users, test_13_users_content | ✓ | ✗ |
Unavailable Resources:
| Resource Name | Ghost Path | Admin? | Content? | Reason |
|---|---|---|---|---|
| Tiers | /tiers | ✓ | ✓ | Testing Failed |
| Offers | /offers | ✓ | ✗ | Testing Failed |
| Webhooks | /webhooks | ✓ | ✗ | TODO |
Metadata
Release files for edwh-ghost 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| edwh_ghost-0.2.3.tar.gz | 78.8 kB | Without provenance | Details for edwh_ghost-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| edwh_ghost-0.2.3-py3-none-any.whl | Python 3 | none | any | Details for edwh_ghost-0.2.3-py3-none-any.whl |
Total release size: 93.3 kB
Release files / edwh_ghost-0.2.3.tar.gz
| Download URL | edwh_ghost-0.2.3.tar.gz |
|---|---|
| Size | 78.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2711c54522c638d79e20ec62d84d7f221d1fd5fe824d60e8f50c026720a9d266
|
|
BLAKE2b-256 checksum How to use checksums |
2129ed72d8b26b18f2a7da5a6f277e570402f7281e70a6585c25d54f33ae7c58
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.2","id":"zara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / edwh_ghost-0.2.3-py3-none-any.whl
| Download URL | edwh_ghost-0.2.3-py3-none-any.whl |
|---|---|
| Size | 14.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
835b4b58af4340aaa57521dc89445c5bc9d6f0c3c8d6027d4b769cb84b210245
|
|
BLAKE2b-256 checksum How to use checksums |
676eeaff94a2587c192150f98a8fe7963c074f9733bf1c4467d8f375f7634018
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.2","id":"zara","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for edwh-ghost 0.2.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.