lswapi (beta)
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:
- One is based on the
requestsmodule. - The second one is based on the
aiohttpmodule 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
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Make sure that tests pass (
make test) - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
Metadata
Release files for lswapi 0.5.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| lswapi-0.5.6.tar.gz | 8.8 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| lswapi-0.5.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 20.7 kB
Release files / lswapi-0.5.6.tar.gz
| Download URL | lswapi-0.5.6.tar.gz |
|---|---|
| Size | 8.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
23119befcbbfc3b04ad32e0086984514df8e5481c6a6899e54b3e3ec5c1c1972
|
|
BLAKE2b-256 checksum How to use checksums |
0d6587846ec15e8f730845dde4a82293a7860ddcb690d5e8e453078026c05c3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","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.6-py3-none-any.whl
| Download URL | lswapi-0.5.6-py3-none-any.whl |
|---|---|
| Size | 11.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1bd1f02902a3a96a9e63c49c56d99f58a302865eae95a5694541ea5a5d6ed652
|
|
BLAKE2b-256 checksum How to use checksums |
487b54bbcafc8932db41c1be6c394d9df48192a0547e850bfc6a650105059ca4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.24 {"installer":{"name":"uv","version":"0.12.24","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}
|
Security for lswapi 0.5.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.