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.12.0.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

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

snap_http-1.12.0-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: snap_http-1.12.0.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.3 Linux/6.17.0-1012-oem

File hashes

Hashes for snap_http-1.12.0.tar.gz
Algorithm Hash digest
SHA256 c04e498474162ff565729e0756a99a658e4f757cb9689a79fbee68716cb7d29d
MD5 d9057112c0b6fcb8badaf99c6ff288f3
BLAKE2b-256 4ad30a177f3d30273650a4d4a12d43af71c3cce198f9f309ac7b3f4d3f18d661

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snap_http-1.12.0-py3-none-any.whl
  • Upload date:
  • Size: 22.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.12.3 Linux/6.17.0-1012-oem

File hashes

Hashes for snap_http-1.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 936de150ee829ae0aeb77e7c42b62b8abe1a9dadc9d1a46acc751a54014676ca
MD5 cf844a410c5c0aa1cd226c257d9176fd
BLAKE2b-256 e27711548b9f2ccc1e96ba9e96a75787f64867ccfb18ed83aa3e4f1cda9ab9cb

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