Skip to main content

A remote CLI and Python client SDK for Mezzanine REST API.

Project description

# Mezzanine API Client

[![Download from PyPI](](
[![Join the chat](](

A remote CLI and Python client SDK for [Mezzanine API](

It enables a user or service to remotely read or write to [Mezzanine CMS]( using Python or the command line. For example, you can write an article in Markdown on your laptop and type a simple command to automatically upload it and create a new blog post from it on your website.

# Installation

$ pip install -U mezzanine-client

# Prerequisites

Install [Mezzanine API]( either locally (for development) or remotely (for production), as we need an API to connect to.

Once Mezzanine API is installed,

1. Login to your Mezzanine CMS Admin Panel (e.g. [](
2. In the menu, click *OAuth* > *Applications*
3. Create a new application with the following details:

App Name: Mezzanine Python Client
App ID: id
App Secret: secret
Client Type: Confidential
Grant Type: Code
Redirect URI:

For development purposes, you can define the simple app ID and secret above, otherwise use the automatically generated ones.

# CLI Documentation

[CLI Documentation Website](

## Configuration

Generally, you must set at least three configuration options: API URL, OAuth App ID, and OAuth App Secret. These settings correspond to the location of your Mezzanine API instance and your OAuth credentials to authenticate with it (as was discussed further in the above *Prerequisites* section).

$ mezzanine-cli config api_url
$ mezzanine-cli config client_id id
$ mezzanine-cli config client_secret secret

You can also see your current configuration and available options by issuing the `mezzanine-cli config` command without any arguments. Note that the `refresh_token` setting should not be altered.

## Getting started

Some examples:

# List all posts (most recent first).
$ mezzanine-cli posts list

# Get the post with the ID of 2.
$ mezzanine-cli posts get 2

# Create a post from a Markdown file.
$ mezzanine-cli posts create \
--title='Test Post from API Client' \
--content-file=~/Desktop/ \
--categories='Test,Fun' \

Just add `--help` to any command in order to get help on the command line:

# General help.
$ mezzanine-cli

# View available options for creating posts.
$ mezzanine-cli posts create --help

Finally, if you wish to clear the credentials and reset CLI configuration, you can do so by running:

$ mezzanine-cli logout

# SDK Documentation

[SDK Documentation Website](

Example code to display recent blog posts:

from mezzanine_client import Mezzanine
api = Mezzanine( 'app_id', 'app_secret' )

# Recent posts
published_posts = api.get_posts(offset=0, limit=10)
for post in published_posts:
print('{} (ID: {})'.format(post['title'], post['id']))

Further examples, such as for creating, listing, and retrieving blog posts, can be found in the [*examples*]( directory.

# Community

Join us in the [Mezzanine API chat room]( or leave a message and we will try to get back to you.

Feel free to [star]( Mezzanine Client on Github to show your support and monitor updates.

Please file a [ticket]( or contribute a pull request on GitHub for bugs or feature requests.

# License

Licensed under the [ISC License](

Created by [George Cushen](

Project details

Download files

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

Source Distribution

mezzanine-client-0.2.2.tar.gz (10.4 kB view hashes)

Uploaded source

Built Distribution

mezzanine_client-0.2.2-py2.py3-none-any.whl (10.8 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page