Skip to main content

lswapi (beta)

Actions Status

Python module to talk to Leaseweb's API.

For more information refer to the documentation available at [http://developer.leaseweb.com]

This module contains two api clients:

  1. One is based on the requests module.
  2. The second one is based on the aiohttp module for asyncio support.

Installation

Install the module using pip. This will not install requests or aiohttp.

pip install lswapi

You can install optional depencies, such as aiohttp:

pip install 'lswapi[aio]'

Or if you prefer to use requests:

pip install 'lswapi[requests]'

Usage

Using requests

The lswapi.requests.get_leaseweb_api function creates an instance of the Leaseweb Api object with the X-Lsw-Auth key. You can provide the api key as an argument to get_leaseweb_api

$ python
>>> from lswapi.requests import get_leaseweb_api
>>> client = get_leaseweb_api(api_key="xxxx-xxx-xxxxxx")
>>> response = client.get("/bareMetals/v2/servers")
>>> servers = response.json()

or get LSW_API_KEY from an environment variable:

$ LSW_API_KEY=xxxx-xxxx-xxxxx python
>>> from lswapi.requests import get_leaseweb_api
>>> client = get_leaseweb_api()
>>> response = client.get("/bareMetals/v2/servers")
>>> servers = response.json()

Using aiohttp

The lswapi.aio.get_leaseweb_api function creates an instance of the Leaseweb Api object with the X-Lsw-Auth key. You can provide the api key as an argument to get_leaseweb_api or via the environment variable LSW_API_KEY:

$ python -m asyncio
>>> from lswapi.aio import get_leaseweb_api
>>> client = get_leaseweb_api(api_key="xxxx-xxx-xxxxxx")
>>> response = await client.get("/bareMetals/v2/servers")
>>> servers = await response.json()

Contribute

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Make sure that tests pass (make test)
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request

Release files for lswapi 0.5.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lswapi 0.5.5
File Size Uploaded
lswapi-0.5.5.tar.gz 8.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lswapi 0.5.5
File Interpreter ABI Platform
lswapi-0.5.5-py3-none-any.whl Python 3 none any Details

Total release size: 20.7 kB

Release files / lswapi-0.5.5.tar.gz

Download URL lswapi-0.5.5.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
73da20e6ddc753c9baa37548e1be8ffb795df5b56fe4aae9e97f8e56e244838c
BLAKE2b-256 checksum
How to use checksums
a6d5f8bf707f697fa7242925fec9a16f77728e73ee409dc9e0e684e17f680874
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.12 {"installer":{"name":"uv","version":"0.12.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / lswapi-0.5.5-py3-none-any.whl

Download URL lswapi-0.5.5-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
86e2c92b5f5f5695ca5cd426b274c4f614d95c36d66cd1f81c157b0d5996e453
BLAKE2b-256 checksum
How to use checksums
ebace7c71ee008460ad9fd44c6f1500bde7405357d77c356c55a1851d4395cac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.12 {"installer":{"name":"uv","version":"0.12.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.5.5 This release

2 release files

0.5.4

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.0

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

1 release file

0.4.0

1 release file

0.3.5

1 release file

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page