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 = vouchers[0]

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

Uploaded Source

File details

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

File metadata

  • Download URL: univoucher-2.0.0.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.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1

File hashes

Hashes for univoucher-2.0.0.tar.gz
Algorithm Hash digest
SHA256 13c95c229ab898f4ff4079bec05b8ea8c6ac41083cdf79851aba78c3ccda64b8
MD5 f788b73d8189e0b9a255a4e341741c97
BLAKE2b-256 625c5f747f3d9e6eab976ee499e7f5fdf87ee488c8ef0b3045a566f563a298a8

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