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

Python language SDK for FusionExport system

Project Description

Language SDK for FusionExport which enables exporting of charts & dashboards through Python.

Installation

To install this Python package, simply use:

pip install fusionexport

Getting Started

After installing the package, create a new file named chart-config.json which contains the chart configurations to be exported. Before exporting your chart, make sure the export server is running.

The chart-config.json file looks as shown below:

[{
    "type": "column2d",
    "renderAt": "chart-container",
    "width": "600",
    "height": "400",
    "dataFormat": "json",
    "dataSource": {
        "chart": {
            "caption": "Number of visitors last week",
            "subCaption": "Bakersfield Central vs Los Angeles Topanga"
        },
        "data": [
            {
                "label": "Mon",
                "value": "15123"
            },
            {
                "label": "Tue",
                "value": "14233"
            },
            {
                "label": "Wed",
                "value": "25507"
            }
        ]
    }
}]

Now, import the fusionexport module into your project and write export logic as follows:

from fusionexport import ExportManager, ExportConfig  # Import sdk


def read_file(file_path):
    try:
        with open(file_path, "r") as f:
            return f.read()
    except Exception as e:
        print(e)


# Called when export is done
def on_export_done(result, error):
    if error:
        print(error)
    else:
        print(result)


# Called on each export state change
def on_export_state_changed(state):
    print(state)


# Instantiate the ExportConfig class and add the required configurations
export_config = ExportConfig()
export_config["chartConfig"] = read_file("chart-config.json")

# Instantiate the ExportManager class
em = ExportManager()
# Call the export() method with the export config and the respective callbacks
em.export(export_config, on_export_done, on_export_state_changed)

Now run this file, then the exported chart will be received on ExportDone event.

API Reference

You can find the full reference here

Release History

This version
History Node

1.0.0b0

Download Files

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

File Name & Hash SHA256 Hash Help Version File Type Upload Date
fusionexport-1.0.0b0-py2.7.egg
(5.2 kB) Copy SHA256 Hash SHA256
2.7 Egg Dec 1, 2017
fusionexport-1.0.0b0-py2.py3-none-any.whl
(7.5 kB) Copy SHA256 Hash SHA256
py2.py3 Wheel Dec 1, 2017
fusionexport-1.0.0b0.tar.gz
(4.5 kB) Copy SHA256 Hash SHA256
Source Dec 1, 2017

Supported By

WebFaction WebFaction Technical Writing 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 Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting