GhostContentClient

Documentation for eth_defi.vault_report.ghost.GhostContentClient Python class.

class GhostContentClient

Bases: object

Read published posts with the Ghost Content API.

Parameters
  • api_url – Ghost site API URL, e.g. https://example.ghost.io.

  • content_api_key – Content API key.

  • timeout – HTTP timeout in seconds.

Methods summary

__init__(api_url, content_api_key[, timeout])

param api_url

fetch_latest_post_by_slug_prefix(slug_prefix)

Find the most recently published post whose slug starts with a prefix.

fetch_latest_posts(nql_filter, limit)

Fetch the most recently published posts that match a filter.

__init__(api_url, content_api_key, timeout=30.0)
Parameters
  • api_url (str) – Ghost site API URL, e.g. https://example.ghost.io.

  • content_api_key (str) – Content API key.

  • timeout (float) – HTTP timeout in seconds.

Return type

None

fetch_latest_post_by_slug_prefix(slug_prefix)

Find the most recently published post whose slug starts with a prefix.

Uses a NQL filter slug:~^'prefix'.

Parameters

slug_prefix (str) – E.g. the-best-performing-stablecoin-vaults.

Returns

The latest post including its HTML body, or None.

Return type

Optional[eth_defi.vault_report.ghost.GhostPost]

fetch_latest_posts(nql_filter, limit)

Fetch the most recently published posts that match a filter.

See the Content API filtering documentation for the NQL syntax.

Parameters
  • nql_filter (str) – NQL filter, e.g. title:~'episode' for titles containing a word.

  • limit (int) – Maximum number of posts.

Returns

Posts including their HTML bodies, newest first.

Return type

list[eth_defi.vault_report.ghost.GhostPost]