Skip to main content

python library for lxd

Project description

# pylxd [![Build Status](https://travis-ci.org/lxc/pylxd.svg?branch=master)](https://travis-ci.org/lxc/pylxd)

A Python library for interacting with the LXD REST API.

## Getting started with pylxd

If you're running on Ubuntu Wily or greater:

sudo apt-get install python-pylxd lxd

otherwise you can track LXD development on other Ubuntu releases:

sudo add-apt-repository ppa:ubuntu-lxc/lxd-git-master && sudo apt-get update
sudo apt-get install lxd

and install pylxd using pip:

pip install pylxd

## First steps

Once you have pylxd installed, you're ready to start interacting with LXD:

```python
import uuid
from pylxd import api

# Let's pick a random name, avoiding clashes
CONTAINER_NAME = str(uuid.uuid1())

lxd = api.API()

try:
lxd.container_defined(CONTAINER_NAME)
except Exception as e:
print("Container does not exist: %s" % e)

config = {'name': CONTAINER_NAME,
'source': {'type': 'none'}}
lxd.container_init(config)
if lxd.container_defined(CONTAINER_NAME):
print("Container is running")
else:
print("Whoops - please report a bug!")
containers = lxd.container_list()
for x in containers:
lxd.container_destroy(x)
```

## Bug reports

Bug reports can be filed at https://github.com/lxc/pylxd/issues/new

## Support and discussions

We use the LXC mailing-lists for developer and user discussions, you can
find and subscribe to those at: https://lists.linuxcontainers.org

If you prefer live discussions, some of us also hang out in
[#lxcontainers](http://webchat.freenode.net/?channels=#lxcontainers) on irc.freenode.net.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pylxd-0.18.0.tar.gz (25.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pylxd-0.18.0-py2-none-any.whl (108.6 kB view details)

Uploaded Python 2

File details

Details for the file pylxd-0.18.0.tar.gz.

File metadata

  • Download URL: pylxd-0.18.0.tar.gz
  • Upload date:
  • Size: 25.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pylxd-0.18.0.tar.gz
Algorithm Hash digest
SHA256 d3cd6d9cd7bb7a8c6505c238855916feb93a7d26a7ca41cd3d50cf38fb50f23b
MD5 c0479c5115f39fc31e4fa971f6799288
BLAKE2b-256 2cfef59b61c3c8a8f25ec27996447e315b552188559390ed76db993ba26af805

See more details on using hashes here.

File details

Details for the file pylxd-0.18.0-py2-none-any.whl.

File metadata

File hashes

Hashes for pylxd-0.18.0-py2-none-any.whl
Algorithm Hash digest
SHA256 193440b0397e7b12de640fd8d1ac673f76a5b5c0a7cf64085e2d85ac8bf81b3b
MD5 16ee0b4bb5b5e127a24332f52dada85f
BLAKE2b-256 86abfdb456bd3258306e5976c40cd9715a41489773ec906122340bf29943a416

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page