Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Async wrapper for the domainFACTORY JiffyBox API

Project description

JiffyBox-Async

Async wrapper for the domainFACTORY JiffyBox API

PyPI version Documentation Status Codacy Badge

Requirements

python>=3.6.0
asyncio
aiohttp

Installation

pip install JiffyBoxAsync

Example

import aiohttp
import logging
import asyncio

from JiffyBoxAsync import JiffyBoxClient


async def example(loop):
    async with aiohttp.ClientSession(loop=loop) as session:
        client = JiffyBoxClient(
            api_key="dWzPcQG8vqh8g2RRZtFM6sqVhebZjt6h",
            session=session
        )

        # Get all JiffyBoxes
        boxes = await client.all_jiffyboxes()

        # Find a box
        box_from_name = await client.find_jiffybox(name="boxname")
        box_from_id = await client.find_jiffybox(id=123456)
        box_from_ip = await client.find_jiffybox(ip="100.200.300.400") # public or private ip

        # Create a box
        new_box = await client.create_jiffybox(name="boxname", planid=44, distribution="ubuntu_18_4_lts_64bit")
        new_box_with_password = await client.create_jiffybox(name="boxname", planid=44, distribution="ubuntu_18_4_lts_64bit", password=password)
        new_box_from_existing = await client.create_jiffybox(name="boxname", planid=44, boxid=123456)
        cloned_box = await new_box.clone(name="boxname", planid=44)

        # Delete a box
        box = await client.find_jiffybox(name="boxname")
        await box.delete()

        # Manage a box
        box = await client.find_jiffybox(name="boxname")
        await box.set_status("START", thaw_before=True)
        await box.set_status("SHUTDOWN", freeze_after=True)

        # Manage backups
        backups = await box.all_backups()
        await box.activate_backup(dayid=0, timeid=2)
        await box.edit_backup(timeid=6)
        await box.deactivate_backups()
        await box.create_backup()
        backup = await box.find_backup(backuptype="daily")
        await backup.restore()
        await backup.delete()


if __name__ == '__main__':
    logging.basicConfig(level=logging.INFO, format='%(message)s', datefmt='%H:%M')

    loop = asyncio.get_event_loop()
    loop.run_until_complete(example(loop))

Project details


Download files

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

Files for JiffyBoxAsync, version 0.0.12
Filename, size File type Python version Upload date Hashes
Filename, size JiffyBoxAsync-0.0.12-py3-none-any.whl (8.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size JiffyBoxAsync-0.0.12.tar.gz (6.5 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page