Skip to main content

Python library for the Hyper API.

Project description

Hyper Python Library

The Hyper Python library provides convenient access to the Hyper API from applications written in the Python language.

Documentation

See the API docs.

Installation

pip install --upgrade hyper-python

Requirements

  • Python 3

Usage

The library needs to be configured with your account's secret key which is available in your Hyper Dashboard. Set hyper.api_key to its value:

import hyper
hyper.api_key = 'sk_...'

# create license
license = hyper.License.create(
    email='hello@hyper.co',
    plan='f80gre098nbgoiA',
    # see API docs for remaining parameters
)

# print the license's email
print(license.email)


# retrieve specific license
license = hyper.License.retrieve('6WHJ-GIPG-28KF-U0MB')

# print that license's email
print(license.email)


# update specific license
license = hyper.License.update(
    key='6WHJ-GIPG-28KF-U0MB',
    metadata={'hwid': '09584903'}
)

# print that license's metadata
print(license.metadata)


# delete specific license
hyper.License.delete('6WHJ-GIPG-28KF-U0MB')


# list licenses
licenses = hyper.License.list(
    limit=50,  # default is 10
    page=1  #default is 1
)

# print the first license's email
print(licenses.data[0].email)


# send specific license
hyper.License.send('6WHJ-GIPG-28KF-U0MB')

Handling exceptions

Unsuccessful requests raise exceptions. The class of the exception will reflect the sort of error that occurred.

try:
  # Use Hyper's library to make requests...
  pass
except hyper.error.AuthenticationError as e:
  # Authentication with Hyper's API failed
  # (maybe you changed API keys recently)
  pass
except hyper.error.InvalidRequestError as e:
  # Invalid parameters were supplied to Hyper's API
  pass
except Exception as e:
  # Something else happened, unrelated to Hyper
  pass

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

hyper-python-0.0.1.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

hyper_python-0.0.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file hyper-python-0.0.1.tar.gz.

File metadata

  • Download URL: hyper-python-0.0.1.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.1

File hashes

Hashes for hyper-python-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c149b4a51c1d9f70e36e89a87a77dd273d1738c53198a471bacc01a7104820db
MD5 0f03da8abdd43ce173f42daab5ccaa54
BLAKE2b-256 c2fcde4343c25d87d3466b9cf472c00953544e6220917b26734c279a84b4f01f

See more details on using hashes here.

File details

Details for the file hyper_python-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: hyper_python-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.1

File hashes

Hashes for hyper_python-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9729aa84c8c07ae223816e0de461f34fdccb9fa060181901457a9ba3611d61f6
MD5 b122975db2d9450d0a4f0e36840effbb
BLAKE2b-256 3d2c146610e64d4a20006d8714c311eeda3bacfab8675caa78618c5942d98082

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