A Linode APIv3 client for Python3
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
linode_api3
.gitignore
LICENSE.txt
README.md
setup.cfg
setup.py

README.md

This is a Linode APIv3 client for Python 3.

Installing

From PyPi

$ pip3 install linode_api3

From git

$ git clone https://github.com/eatonphil/python-linode_apiv3
$ cd python-linode_apiv3
$ pip3 install -e .

Example

$ LINODE_APIV3_KEY=$(cat ~/.linode_v3.token) python3
>>> from linode_api3 import linode
>>> # or if you don't want to set an environment variable: from linode_api3 import init; init(LINODE_APIV3_KEY)
>>> for l in linode.view():
>>>    print(l.label)
>>>    for d in linode.disk.view(l.linodeid):
>>>        print('\t', d.disk)

Modules and Functions

linode

linode.boot()

linode.boot(linode_id, config_id=None)

External references:

Input

Field Type
linode_id number
config_id number

Output

Field Type
jobid number

linode.clone()

linode.clone(linode_id, datacenter_id, plan_id, payment_term=None)

External references:

Input

Field Type
linode_id number
datacenter_id number
plan_id number
payment_term number

Output

Field Type
linodeid number

linode.create()

linode.create(datacenter_id, plan_id, payment_term=None)

External references:

Input

Field Type
datacenter_id number
plan_id number
payment_term number

Output

Field Type
linodeid number

linode.delete()

linode.delete(linode_id, skip_checks=None)

External references:

Input

Field Type
linode_id number
skip_checks boolean

Output

Field Type
linodeid number

linode.kvmify()

linode.kvmify(linode_id)

External references:

Input

Field Type
linode_id number

linode.mutate()

linode.mutate(linode_id)

External references:

Input

Field Type
linode_id number

linode.reboot()

linode.reboot(linode_id, config_id=None)

External references:

Input

Field Type
linode_id number
config_id number

Output

Field Type
jobid number

linode.resize()

linode.resize(linode_id, plan_id)

External references:

Input

Field Type
linode_id number
plan_id number

linode.shutdown()

linode.shutdown(linode_id)

External references:

Input

Field Type
linode_id number

Output

Field Type
jobid number

linode.update()

linode.update(linode_id, label=None, group=None, alerts=None, backups=None, watchdog=None, ssh=None)

External references:

Input

Field Type
linode_id number
label string
group string
alerts Alert
backups Backup
watchdog boolean
ssh Ssh
Alert
Field Type
cpu AlertOptions
diskio AlertOptions
bandwidth_in AlertOptions
bandwidth_out AlertOptions
bandwidth_quota AlertOptions
AlertOptions
Field Type
enabled boolean
threshold number
Backup
Field Type
window number
weekday number
Ssh
Field Type
disabled boolean
user string
ip string
port number

Output

Field Type
linodeid number

linode.view()

linode.view(linode_id=None)

External references:

Input

Field Type
linode_id number

Output (list)

Field Type
alert_bwin_enabled boolean
alert_bwin_threshold number
alert_bwout_enabled boolean
alert_bwout_threshold number
alert_bwquota_enabled boolean
alert_bwquota_threshold number
alert_cpu_enabled boolean
alert_cpu_threshold number
alert_diskio_enabled number
alert_diskio_threshold boolean
backupsenabled boolean
backupweeklyday number
backupwindow number
create_dt date
datacenterid number
distributionvendor string
iskvm boolean
isxen boolean
label string
linodeid number
lpm_displaygroup string
planid number
status string
totalhd number
totalram number
totalxfer number
watchdog boolean

linode.config

linode.config.create()

linode.config.create(linode_id, kernel_id, label, disks, comments=None,
                     ram_limit=None, virt_mode=None, run_level=None,
                     root_device=None, helpers=None, automount_devtmpfs=None)

External references:

Input

Field Type
linode_id number
kernel_id number
label string
comments string
ram_limit number
virt_mode string
run_level string
root_device RootDevice
helpers Helpers
automount_devtmpfs boolean
RootDevice
Field Type
number number
custom string
read_only boolean
Helpers
Field Type
disable_update_db boolean
distro boolean
xen boolean
depmod boolean
network boolean

Output

Field Type
configid number

linode.config.delete()

linode.delete(linode_id, config_id)

External references:

Input

Field Type
linode_id number
config_id number

Output

Field Type
configid number

linode.config.update()

linode.config.update(linode_id, config_id, kernel_id, label, disks,
                     comments=None, ram_limit=None, virt_mode=None,
                     run_level=None, root_device=None, helpers=None,
                     automount_devtmpfs=None)

External references:

Input

Field Type
linode_id number
config_id number
kernel_id number
label string
comments string
ram_limit number
virt_mode string
run_level string
root_device RootDevice
helpers Helpers
automount_devtmpfs boolean
RootDevice
Field Type
number number
custom string
read_only boolean
Helpers
Field Type
disable_update_db boolean
distro boolean
xen boolean
depmod boolean
network boolean

Output

Field Type
configid number

linode.config.view()

linode.config.view(linode_id, config_id=None)

External references:

Input

Field Type
linode_id number
config_id number

Output (list)

Field Type
rootdevicenum number
rootdevicecustom string
runlevel string
helper_xen number
virt_mode number
disklist number (list)
isrescue boolean
kernelid number
helper_network number
linodeid number
comments string
configid number
helper_libtls number
rootdevicero boolean
devtmpfs_automount boolean
helper_disableupdatedb number
helper_depmod number
ramlimit number
label string
helper_distro number

linode.disk

linode.disk.create()

linode.disk.create(linode_id, label, kind, size, read_only=None)

External references:

linode.disk.create_from_distribution()

linode.disk.create_from_distribution(linode_id, distribution_id, label, size, password, sshKey=None)

External references:

linode.disk.create_from_image()

linode.disk.create_from_image(linode_id, image_id, label=None, size=None, password=None, sshKey=None)

External references:

linode.disk.create_from_stackscript()

linode.disk.create_from_stackscript(linode_id, stackscript_id, stackscript_fields, distribution_id, label, size, password, sshKey=None)

External references:

linode.disk.delete()

linode.disk.delete(linode_id, disk_id)

External references:

linode.disk.duplicate()

linode.disk.duplicate(linode_id, disk_id)

External references:

linode.disk.imagize()

linode.disk.imagize(linode_id, disk_id, label=None, comments=None)

External references:

linode.disk.resize()

linode.disk.resize(linode_id, disk_id, size)

External references:

linode.disk.update()

linode.disk.update(linode_id, disk_id, label=None, read_only=None)

External references:

linode.disk.view()

linode.disk.view(linode_id, disk_id=None)

External references:

linode.ip

linode.ip.addprivate()

linode.ip.addprivate(linode_id)

External references:

linode.ip.addpublic()

linode.ip.addpublic(linode_id)

External references:

linode.ip.setrdns()

linode.ip.setrdns(ip_id, hostname)

External references:

linode.ip.swap()

linode.ip.swap(ip_id, ip_id_b=None, linode_id_b=None)

External references:

linode.ip.view()

linode.ip.view(linode_id, ip_id=None)

External references:

linode.job

linode.job.view()

linode.job.view(linode_id, job_id=None, pending=None)

External references:

avail

avail.datacenters()

avail.datacenters()

External references:

Output (list)

Field Type
location string
datacenterid number
abbr string

avail.distributions()

avail.distributions(distribution_id=None)

External references:

Input

Field Type
distribution_id number

Output (list)

Field Type
create_dt string
requirespvopskernel number
label string
distributionid number
minimagesize number
is64bit number

avail.kernels()

avail.kernels(xen=None, kvm=None)

External references:

Input

Field Type
xen boolean
kvm boolean

Output (list)

Field Type
iskvm boolean
kernelid number
label string
ispvops boolean
isxen boolean

avail.linodeplans()

avail.linodeplans(plan_id=None)

External references:

Input

Field Type
plan_id number

Output (list)

Field Type
cores number
xfer number
price number
planid number
label string
disk number
ram number
hourly number

TODO: missing avail field

avail.nodebalancers()

avail.nodebalancers()

External references:

Output (list)

Field Type
connections number
monthly number
hourly number

avail.stackscripts()

avail.stackscripts(distribution_id=None, vendor=None, keywords=None)

External references:

Input

Field Type
distribution_id number
vendor string
keywords string

Output (list)

Field Type
rev_note string
distributionidlist number (list)
rev_dt string
create_dt string
script string
deploymentstotal number
description string
deploymentsactive number
ispublic boolean
stackscriptid number
userid number
label string
latestrev number