Skip to main content

Programmatically create UniFi Guest vouchers

Project description

Example

from univoucher import models, local
from getpass import getpass
import math

netloc = input("Netloc: ") # <host>:<port>
username = input("Username: ")
password = getpass("Password: ")

client:models.Client = local.Client(netloc, username, password)
client.verify = False

# Create one voucher
# A guest can use it for 1000 minutes when redeemed
# The voucher can be redeemed an unlimited amount of times
vouchers = client.fetch(amount=1, duration=1000, uses=math.inf)

unlimited_uses_voucher:models.Voucher = next(vouchers)

print(unlimited_uses_voucher.code)

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

univoucher-2.0.1.tar.gz (2.8 kB view details)

Uploaded Source

File details

Details for the file univoucher-2.0.1.tar.gz.

File metadata

  • Download URL: univoucher-2.0.1.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.23.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for univoucher-2.0.1.tar.gz
Algorithm Hash digest
SHA256 674b94821c29d7e59c10d020cb614d28214b747922d29ed248731035d5449978
MD5 34c6b0948da1a561cf88a880a0ccc21f
BLAKE2b-256 bf67eb132468067345eb290e6cfba1696f9a4d23cd6ba51d74bd1b793cd80ecf

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