dragon_rest.dragons

DragonAPI is a Python wrapper for the DragonMint T1.

Module Contents

Classes

DragonAPI

DragonMint/Innosilicon API wrapper.

class dragon_rest.dragons.DragonAPI(host, username='admin', password='dragonadmin', timeout=60, jwt=None)

DragonMint/Innosilicon API wrapper.

This wrapper should work with both DragonMint and Innosilicon branded miners. If you have problems with the API, please open GitHub issue accordingly.

The official documentation for the API is avaiable at: https://halongmining.com/api/

Example:

from dragon_rest.dragons import DragonAPI

dragon_host = '10.0.0.1'
api = DragonAPI(dragon_host,
                username='admin',
                password='dragonadmin')

r = api.summary()
print(r)
# now you're in the big leagues, boye 😉
static is_dragon(host, timeout=1)

Check if host is a dragon.

Check if the specified host is a dragon based on simple heuristic. The code simply checks if particular strings are in the index page. It should work for DragonMint or Innosilicon branded miners.

__post(self, path, data=None)
__post_files(self, path, files)
__get_stream(self, path)
auth(self)

Authenticate with the miner and obtain a JSON web token (JWT).

summary(self)

Fetch DEVS, POOLS and Fan Speed from the cgminer API.

overview(self)

Fetch miner overview.

Fetch miner type, hardware information, network information and versions of the miner

errors(self)

Returns errors

pools(self)

Receive the configured pools of the miner.

updatePools(self, pool1, username1, password1, pool2=None, username2=None, password2=None, pool3=None, username3=None, password3=None)

Change the pools of the miner. This call will restart cgminer.

updatePassword(self, user, currentPassword, newPassword)

Change the password of a user.

network(self)

Get the current network settings.

updateNetwork(self, dhcp='dhcp', ipaddress=None, netmask=None, gateway=None, dns=None)

Change the current network settings.

type(self)

Return the type of the miner.

reboot(self)

Reboot the miner.

poweroff(self)

Power Off the Miner.

restartCgMiner(self)

Restart cgminer.

factoryReset(self)

Remove all user settings and reboot the miner.

getAutoTune(self)

Return cgminer auto-tune mode.

getAutoTuneStatus(self)

Return cgminer Auto-Tune status.

setAutoTune(self, autotune, level=2)

Set cgminer to use or not embedded auto-tune functionality.

upgradeUpload(self, file)

Upgrade the firmware of the miner.

upgradeDownload(self, url)

Upgrade the firmware of the miner with a URL of the update file.

getLatestFirmwareVersion(self)

Return the latest version available of the miner.

getDebugStats(self)

Get debug status of miner.

Return the cgminer stats of each board and each chip of the miner.

streamLogs(self)

Return systemd-journald logs in chunked packages.