Skip to main content

A library for interacting with snapd via its REST API.

Project description

snap-http

check

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'

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

snap_http-1.8.0.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

snap_http-1.8.0-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file snap_http-1.8.0.tar.gz.

File metadata

  • Download URL: snap_http-1.8.0.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.3 Linux/6.11.0-26-generic

File hashes

Hashes for snap_http-1.8.0.tar.gz
Algorithm Hash digest
SHA256 2a0b0087161b2d1d1b6bfb6737a509602d3e0cfe140effbc85e1bf9a33708be6
MD5 c84bf16b8ae3403ee055d41104336aac
BLAKE2b-256 841af4724ac26f2fe6699eca5dfcb087279ff81a3057584a6bb3ae5a265b4a39

See more details on using hashes here.

File details

Details for the file snap_http-1.8.0-py3-none-any.whl.

File metadata

  • Download URL: snap_http-1.8.0-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.3 Linux/6.11.0-26-generic

File hashes

Hashes for snap_http-1.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0a3907eb9b0b4e22ad551118c9d81474f7cd02b43ed155bfb359ced6ca625e4c
MD5 14583b3fdb4e299f41a4249d5e47a03f
BLAKE2b-256 c7de8ff72364ccdff01bb87fd9f091359ce1858a82c5932bb0875d8dd3e5421e

See more details on using hashes here.

Supported by

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