Skip to content

SyncRainbowMinerClient

rainbowminer_api_client.sync_client.SyncRainbowMinerClient

SyncRainbowMinerClient(
    host: str = _DEFAULT_HOST,
    port: int = _DEFAULT_PORT,
    *,
    username: str | None = None,
    password: str | None = None,
    timeout: float = _DEFAULT_TIMEOUT,
    tls: bool = False,
)

Blocking client for a RainbowMiner API server.

Wraps :class:RainbowMinerClient with a private event loop so that every method can be called synchronously. Use it as a context manager for automatic cleanup, or call :meth:close manually.

Configure the sync client and its private event loop.

Parameters:

Name Type Description Default
host str

Hostname or IP address of the RainbowMiner server.

_DEFAULT_HOST
port int

TCP port the API server listens on (default 4000).

_DEFAULT_PORT
username str | None

Optional username for HTTP Basic auth.

None
password str | None

Optional password for HTTP Basic auth.

None
timeout float

Request timeout in seconds.

_DEFAULT_TIMEOUT
tls bool

If True, use https:// instead of http://.

False

close

close() -> None

Close the underlying async client and the private event loop.

get_version

get_version() -> Version

Get the RainbowMiner version (/version).

get_info

get_info() -> Any

Get server info (/info).

get_remote_ip

get_remote_ip() -> str | None

Get the server's remote IP address (/remoteip).

get_console

get_console(*, ts: int | None = None) -> Console

Get the console output and running miner logs (/console).

get_cpu_info

get_cpu_info() -> CPUInfo

Get CPU information (/cpuinfo).

get_sys_info

get_sys_info() -> SysInfo

Get system information (/sysinfo).

get_uptime

get_uptime() -> Uptime

Get RainbowMiner uptime (/uptime).

get_system_uptime

get_system_uptime() -> Uptime

Get the operating system uptime (/systemuptime).

is_server

is_server() -> bool

Check whether the server runs in server mode (/isserver).

get_active_miners

get_active_miners() -> list[ActiveMiner]

Get currently active miners (/activeminers).

get_running_miners

get_running_miners() -> list[RunningMiner]

Get currently running miners (/runningminers).

get_failed_miners

get_failed_miners() -> list[FailedMiner]

Get miners that failed to start (/failedminers).

get_remote_miners

get_remote_miners(
    *, mode: str | None = None
) -> list[RemoteMiner] | list[RemoteMinerEntry]

Get remote miners connected to a server (/remoteminers).

get_miners_needing_benchmark

get_miners_needing_benchmark() -> list[Any]

Get miners that need benchmarking (/minersneedingbenchmark).

get_miner_info

get_miner_info() -> list[MinerInfo]

Get miner capability info (/minerinfo).

get_miner_speeds

get_miner_speeds() -> list[MinerSpeed]

Get miner hashrate speeds (/minerspeeds).

get_pools

get_pools() -> list[Pool]

Get active/enabled pools (/pools).

get_all_pools

get_all_pools() -> list[AllPool]

Get all known pools (/allpools).

get_new_pools

get_new_pools() -> list[NewPool]

Get newly discovered pools (/newpools).

get_algorithms

get_algorithms() -> list[str]

Get supported algorithms (/algorithms).

get_miners

get_miners() -> list[Miner]

Get available miner definitions (/miners).

get_fastest_miners

get_fastest_miners() -> list[FastestMiner]

Get the fastest miners per algorithm/device (/fastestminers).

get_avail_miners

get_avail_miners() -> list[str]

Get the list of available miner base names (/availminers).

get_avail_miner_stats

get_avail_miner_stats() -> list[AvailMinerStat]

Get available miners with stat counts (/availminerstats).

get_disabled

get_disabled() -> list[str]

Get the list of disabled miners/pools (/disabled).

get_wtm_urls

get_wtm_urls() -> dict[str, str]

Get WhatToMine URLs per device model (/getwtmurls).

load_config_json

load_config_json(
    *, config_name: str | None = None
) -> LoadConfigJsonResult

Load a raw config file as JSON string (/loadconfigjson).

load_config

load_config(
    *,
    config_name: str | None = None,
    pool_name: str | None = None,
) -> Any

Load a config section (/loadconfig).

get_config

get_config() -> Config

Get the merged running config (/config).

get_user_config

get_user_config() -> UserConfig

Get user config overrides (/userconfig).

get_oc_profiles

get_oc_profiles() -> list[OCProfile]

Get overclock profiles (/ocprofiles).

get_download_list

get_download_list() -> list[DownloadItem]

Get the download queue (/downloadlist).

get_all_devices

get_all_devices() -> list[AllDevice]

Get all hardware devices (/alldevices).

get_devices

get_devices() -> list[Device]

Get selected/enabled devices (/devices).

get_platforms

get_platforms() -> dict[str, Any]

Get OpenCL platform info (/platforms).

get_device_combos

get_device_combos() -> list[DeviceCombo]

Get device combinations (/devicecombos).

get_device_config

get_device_config() -> list[DeviceConfigEntry]

Get device selection/exclusion state (/getdeviceconfig).

get_stats

get_stats() -> dict[str, Any]

Get the stats cache (/stats).

get_totals

get_totals() -> list[Total]

Get profit/power totals (/totals).

get_totals_csv

get_totals_csv() -> BinaryResponse

Get totals as CSV (/totalscsv).

get_earnings

get_earnings(
    *,
    filter: Mapping[str, Any] | None = None,
    sort: str = "Date",
    order: str | None = None,
    limit: int | None = None,
    offset: int | None = None,
) -> EarningsResult

Get earnings with optional filtering, sorting, and paging (/earnings).

get_earnings_csv

get_earnings_csv() -> BinaryResponse

Get earnings as CSV (/earnings?as_csv=true).

get_session_vars

get_session_vars() -> dict[str, Any]

Get scalar session variables (/sessionvars).

get_session

get_session() -> dict[str, Any]

Get the full session hashtable (/session).

get_gc

get_gc() -> dict[str, Any]

Get the sync-cache contents (/gc).

get_watchdog_timers

get_watchdog_timers() -> list[Any]

Get watchdog timers (/watchdogtimers).

get_crash_counter

get_crash_counter() -> list[Any]

Get crash counter entries (/crashcounter).

get_balances

get_balances(
    *,
    raw: bool = False,
    add_total: bool = False,
    add_wallets: bool = False,
    add_btc: bool = False,
    consolidate: bool = False,
    as_csv: bool = False,
) -> list[Balance] | BinaryResponse

Get balance information (/balances).

get_payouts

get_payouts() -> list[Payout]

Get payout history (/payouts).

get_rates

get_rates(
    *, format: str | None = None
) -> dict[str, float | int] | list[RateTableRow]

Get currency exchange rates (/rates).

get_asyncloader_jobs

get_asyncloader_jobs() -> list[AsyncloaderJob]

Get async loader jobs (/asyncloaderjobs).

get_dec_sep

get_dec_sep() -> str

Get the system's decimal separator (/decsep).

get_miner_log

get_miner_log(
    *, logfile: str | None = None
) -> MinerLogResult

Get the contents of a specific miner log file (/getminerlog).

get_miner_stats

get_miner_stats() -> list[MinerStat]

Get benchmark stats for all miners (/minerstats).

get_activity

get_activity(
    *, as_csv: bool = False
) -> list[Any] | BinaryResponse

Get mining activity history (/activity).

get_computer_stats

get_computer_stats() -> ComputerStats

Get computer statistics (/computerstats).

get_miner_ports

get_miner_ports() -> dict[str, Any]

Get miner port assignments (/minerports).

get_current_profit

get_current_profit() -> CurrentProfit

Get current profit, earnings, rates, power, and uptime (/currentprofit).

get_status

get_status() -> Status

Get the current mining status (/status).

get_clients

get_clients(
    *, include_server: bool = False
) -> list[Client]

Get connected RainbowMiner clients (/clients).

get_mrr_stats

get_mrr_stats() -> list[MrrStat]

Get MiningRigRentals algorithm stats (/mrrstats).

get_mrr_rigs

get_mrr_rigs() -> list[MrrRig]

Get MiningRigRentals rig data (/mrrrigs).

get_mrr_control

get_mrr_control() -> list[MrrControl]

Get MiningRigRentals control settings (/mrrcontrol).

get_setup

get_setup() -> SetupJson

Get the aggregated setup configuration (/setup.json).

set_cmd_key

set_cmd_key(cmd_key: str) -> str

Set the command menu key (/cmdkey).

save_config_json

save_config_json(
    *, config_name: str | None = None, data: str
) -> SaveResult

Save a raw JSON config string (/saveconfigjson).

save_config

save_config(
    *, config_name: str | None = None, **fields: Any
) -> SaveResult

Save config fields (/saveconfig).

stop

stop() -> str

Stop the RainbowMiner server (/stop).

reboot

reboot() -> str

Reboot the machine running RainbowMiner (/reboot).

pause

pause(*, action: str | None = None) -> bool

Pause or unpause mining (/pause).

lock_miners

lock_miners() -> bool

Toggle miner selection lock (/lockminers).

reset_workers

reset_workers() -> str

Reset offline workers on api.rbminer.net (/resetworkers).

apply_oc

apply_oc() -> str

Apply overclock profiles (/applyoc).

update

update() -> bool

Trigger a RainbowMiner self-update (/update).

update_balance

update_balance() -> bool

Trigger a balance update (/updatebalance).

update_mrr

update_mrr() -> bool

Trigger a MiningRigRentals update (/updatemrr).

watchdog_reset

watchdog_reset() -> bool

Reset watchdog timers (/watchdogreset).

toggle_miner

toggle_miner(
    *, name: str, algorithm: str, device_model: str
) -> ToggleResult

Enable or disable a miner (/action/toggleminer).

toggle_pool

toggle_pool(
    *,
    name: str,
    algorithm: str | None = None,
    coin_symbol: str | None = None,
) -> ToggleResult

Enable or disable a pool (/action/togglepool).

save_miner_stats

save_miner_stats(
    *, miner_name: str | None = None
) -> BinaryResponse

Download miner stats as a ZIP archive (/saveminerstats).

get_debug_zip

get_debug_zip() -> BinaryResponse

Download a debug log archive (/debug).