snap-http
snap-http is a Python library used to interact with snapd's REST API, allowing you to programmatically install and manage snaps in your Python applications. It has no dependencies other than Python 3.8 or higher.
Installation
pip install snap-http
Usage
Take a look at the api module to see what methods are available. Here's a couple examples:
List installed snaps
>>> import snap_http
>>> response = snap_http.list()
>>> for snap in response.result:
... print(snap["name"])
juju
snapd
core20
snapcraft
snap-store
<etc>
Install a snap
Most actual changes to snaps happen asynchronously, so you need to check back on the change using the change ID if you want to know the final result.
N.B.: installation may require root permissions.
>>> import snap_http
>>> response = snap_http.install("hello")
>>> response
SnapdResponse(type='async', status_code=202, status='Accepted', result=None, sources=None, change='1395')
>>> response = snap_http.check_change(response.change)
>>> response.result["status"]
'Done'
Metadata
Release files for snap-http 1.12.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 | |
|---|---|---|---|
| snap_http-1.12.1.tar.gz | 17.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| snap_http-1.12.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.7 kB
Release files / snap_http-1.12.1.tar.gz
| Download URL | snap_http-1.12.1.tar.gz |
|---|---|
| Size | 17.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
75e3ea0bd14bbf6498af24935160525f82035fbd0b001a86ccc541de230f5a9c
|
|
BLAKE2b-256 checksum How to use checksums |
946b18772132cd28914a99847913daef9c0f44ecea8f999baf51c9c7bfc7dae0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.12.3 Linux/7.0.0-28-generic
|
Release files / snap_http-1.12.1-py3-none-any.whl
| Download URL | snap_http-1.12.1-py3-none-any.whl |
|---|---|
| Size | 22.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
972978c7e873beca9741a3ccc2e59c68b622fe5f2cf5c2bd7a49af3c0a04661a
|
|
BLAKE2b-256 checksum How to use checksums |
7f9806e7e07676d3de4d38673f42afd9496088008e32334010bd512787a66cb3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.1 CPython/3.12.3 Linux/7.0.0-28-generic
|