Skip to content

A simple API wrapper for the 24Fire Rest API to control basic functions of a KVM server.

License

Notifications You must be signed in to change notification settings

EvickaStudio/24-Fire-REST-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FireAPI

PyPI version Downloads Supported Python versions License: AGPL v3 Code Style

FireAPI is a Python library that serves as a wrapper for the 24Fire REST API. It allows you to perform basic operations on a KVM server using a private API key. The library provides the following functionalities:

  • Get server configuration
  • Get server status
  • Start server
  • Stop server
  • Restart server
  • Async Support

Installation

To install FireAPI, use pip:

pip install fireapi

Alternatively, you can build and install the package manually:

# Clone the repository
git clone https://github.com/EvickaStudio/24-Fire-REST-API.git
# Change directory
cd 24-Fire-REST-API
# Build the package
python setup.py sdist bdist_wheel
# Install the package
pip install ./

Then install the package using pip:

Usage

To get started, import the FireAPI class from the fireapi package and instantiate it using your API key:

from fireapi import FireAPI

API_KEY = "your-api-key-here"
fire_api = FireAPI(API_KEY)

Once the instance is created, you can interact with the 24Fire REST API using the provided methods:

# Get server configuration
config = fire_api.get_config()
print(config)

# Get server status
status = fire_api.get_status()
print(status)

# Start server
start = fire_api.start_server()
print(start)

# Stop server
stop = fire_api.stop_server()
print(stop)

# Restart server
restart = fire_api.restart_server()
print(restart)

When using the async methods, you can use the await keyword to wait for the response:

import asyncio
from fireapi import AsyncFireAPI

async def main():
    API_KEY = "your-api-key-here"
    try:
        fire_api = AsyncFireAPI(API_KEY)
        # Get server configuration
        config = await fire_api.get_config()
        print(config)
    except Exception as e:
        print(f"An error occurred: {e}")

if __name__ == "__main__":
    asyncio.run(main())

Documentation

For more information on the 24Fire REST API, refer to the original documentation.

About

A simple API wrapper for the 24Fire Rest API to control basic functions of a KVM server.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages