pybitlaunch
pybitlaunch is a python library for accessing the BitLaunch API.
You can view BitLaunch API docs here: https://developers.bitlaunch.io/
Install
Source
git clone https://github.com/bitlaunchio/pybitlaunch.git
cd pybitlaunch
python setup.py install
PIP
pip install -U pybitlaunch
Usage
import pybitlaunch
Authentication
You must use your API Token to authenticate with BitLaunch API. You can (re)generate your access token on the BitLaunch API Page.
You can then use your token to create a new client.
client = pybitlaunch.Client(token)
Documentation
For a comprehensive list of examples, check out the API documentation.
Account
Show
accountObj = client.Account.Show()
if accountObj is not None:
# process data
Usage
usage = client.Account.Usage("2020-10")
if usage is not None:
# process data
History
history = client.Account.History(1, 25)
if history is not None:
# process data
SSHKeys
List
sshKeyObjArray = client.SSHKeys.List()
if sshKeyObjArray is not None:
# process data
Create
newKey = pybitlaunch.SSHKey(name="sshkey_name", content="sshkey_rsa_pub")
sshKeyObj, err = client.SSHKeys.Create(newKey)
if err is not None:
# handle error
else:
# process data
Delete
err = client.SSHKeys.Delete(sshKeyObj.id)
if err is not None:
# handle error
Transactions
List
transactionObjArray, err = client.Transactions.List(page=1, pPage=25) # Optional: page, pPage
if err is not None:
# handle error
else:
# process data
Show
transactionObj, err = client.Transactions.Show(transactionObj.id)
if err is not None:
# handle error
else:
# process data
Create
newTransaction = pybitlaunch.Transaction(
amountUSD = 20,
cryptoSymbol = None, # Optional
lightningNetwork = None # Optional
)
transactionObj, err = client.Transactions.Create(newTransaction)
if err is not None:
# handle error
else:
# process data
CreateOptions
Show
createOptionsArray, err = client.CreateOptions.Show(hostID)
# createOptionsArray = ['hostID', 'image', 'region', 'size', 'available', 'bandwidthCost', 'planTypes', 'hostOptions']
if err is not None:
# handle error
else:
# process data
Servers
List
serverObj, err = client.Servers.List()
if err is not None:
# handle error
else:
# process data
Show
serverObj, err = client.Servers.Show(serverObj.id)
if err is not None:
# handle error
else:
# process data
Create
newServer = pybitlaunch.Server(
name = "myServer",
hostID = 4,
hostImageID = "10000",
sizeID = "nibble-1024",
regionID = "lon1",
password = "MySecurePassword", # Optional must use sshKeys instead
sshKeys = [sshKeyObj["id"]], # Optional must use password instead
initscript = None # Optional
)
serverObj, err = client.Servers.Create(serverObj)
if err is not None:
# handle error
else:
# process data
Destroy
err = client.Servers.Destroy(serverObj.id)
if err is not None:
# handle error
Rebuild
createOpts, err = client.CreateOptions.Show(4)
if err is not None:
# handle error
newImage = pybitlaunch.RebuildImage(
createOpts["image"][0]["versions"][1]["id"],
createOpts["image"][0]["versions"][1]["description"]
)
err = client.Servers.Rebuild(serverObj.id, newImage)
if err is not None:
# handle error
Resize
err = client.Servers.Resize(serverObj.id, "nibble-2048")
if err is not None:
# handle error
Restart
err = client.Servers.Restart(serverObj.id)
if err is not None:
# handle error
Protection
server, err = client.Servers.Protection(serverObj.id, True)
if err is not None:
# handle error
else:
# process data
SetPorts
ports = [
pybitlaunch.Port(1234, "tcp"),
pybitlaunch.Port(1234, "udp"),
pybitlaunch.Port(1235, "tcp"),
]
server, err = client.Servers.SetPorts(serverObj.id, ports)
if err is not None:
# handle error
else:
# process data
Release files for pybitlaunch 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pybitlaunch-1.1.1.tar.gz | 8.4 kB | Details |
Release files / pybitlaunch-1.1.1.tar.gz
| Download URL | pybitlaunch-1.1.1.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6947254cb241ce143fe6446af0d5a1d7cd6d9f2342f28d97ca4fc4ad246bb34f
|
|
BLAKE2b-256 checksum How to use checksums |
4107035e9f86d6574fa6d112049e38e6f47befa0439110aef6d11dd7551136d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.6 tqdm/4.62.3 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.9
|