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

Uploaded Source

Built Distribution

snap_http-1.4.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: snap_http-1.4.0.tar.gz
  • Upload date:
  • Size: 14.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/6.5.0-21-generic

File hashes

Hashes for snap_http-1.4.0.tar.gz
Algorithm Hash digest
SHA256 cfa5344703fdca8498dffa71979fcca765c97ca1a15eb7d06814d24ac6698d34
MD5 1eb94205349c4f4de887c3eba5ec9dca
BLAKE2b-256 fa4acf32d2ab52c07dab9f9c0e1973d156ff6e792f68666ea1cad89f0ae469a1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: snap_http-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 15.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.12 Linux/6.5.0-21-generic

File hashes

Hashes for snap_http-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 005ca761f431c418343d53a9e76f66f0a9388be7b529c2b1f92fc40a9eefc4d8
MD5 eddce2d3cdc4f391c5004df60d0ee0b9
BLAKE2b-256 9f81bf46adcd7b4ec1920a00afaf0ac2d00ea09a408a9f794c7b605085b42b28

See more details on using hashes here.

Supported by

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