Python

Connect your Python applications to Gitana

Latest Version
Version undefined
Date
Python

The Gitana Python driver allows you to easily connect your Python 3 applications with the Gitana server. It will work within any Python application and with web frameworks like Flask or Django.

Currently supports the following functionality:

  • Connect to and refresh access tokens with the API
  • Read platform, branch, and repositories
  • Read, query, search, create, update, and delete nodes

Installation

Make sure you first have Python 3 and pip for Python 3 in your environment. Then, run the following to install:

pip install cloudcms

Examples

from cloudcms import CloudCMS

# Connect to Cloud CMS
client = CloudCMS()
platform = client.connect(filename="gitana.json")

# List repositories
repositories = platform.list_repositories()

# Read repository
repository = platform.read_repository('<repository_id>')

# List branches
branches = repository.list_branches()

# Read branch
branch = repository.read_branch('<branch_id>')

# Read Node
node = branch.read_node('<node_id>')

# Create node
obj = {
'title': 'Twelfth Night',
'description': 'An old play'
}
newNode = branch.create_node(obj)

# Query nodes
query = {
'_type': 'store:book'
}
pagination = {
'limit': 2
}
queried_nodes = branch.query_nodes(query, pagination)

# Search/Find nodes
find = {
'search': 'Shakespeare',
'query': {
'_type': 'store:book'
}
}
searched_nodes = branch.find_nodes(find)

Documentation

The Python driver is a useful library that provides access to the capabilities of Gitana from a programmatic perspective. It is therefore important to first familiarize yourself with the concepts presented in the Gitana Documentation.

Fork the Code

The Gitana Python driver is 100% open-source (Apache 2.0) and so you're free to fork it, extend it and dig into it to learn about how it works.

Bugs / Problems

so that we can look at it.

For production support, please contact us at support@gitana.io or call us directly.

Support and Terms of Use

The Python driver is free to use in your applications and projects. It is fully supported by Gitana.