## Install
`pip install arbitrium`
## Usage
```
from arbitrium import menu
from os import exit
@menu(["Option One", "Option Two", "Final Option"])
def choice_handler(choice):
if choice == 1:
# Option One Selected
pass
if choice == 2:
# Option Two Selected
pass
if choice == 3:
# Final Option Selected
exit(1)
# Calling the choice handler will also print the menu
choice_handler()
```
Will produce:
```
1) Option One
2) Option Two
99) Final Option
Please enter your choice:
```
**NOTE: Final Option will always be 99. It will run the choice handler once and then exit the choice handler function.**
## Authentication
Arbitrium provides an easy system for adding auth to your menu:
```
from arbitrium import menu, requires_auth
def auth_function():
u = input("Enter username: ")
p = input("Enter password: ")
# Check Passwords
if password_correct:
return True
return False
@requires_auth(auth_function, True)
@menu(["Option One", "Option Two", "Exit"])
def choice_handler(choice):
[...]
choice_handler()
```
Will run auth_function before a user can see or select any menu options. If auth_function returns True, the menu will run, if it returns False, it will exit with an error message.
Alternatively,
```
from arbitrium import menu, requires_auth
def auth_function(username, password):
# Check Passwords
if password_correct:
return True
return False
@requires_auth(auth_function(input("Please Enter Username"), input("Please Enter Password")))
@menu(["Option One", "Option Two", "Exit"])
def choice_handler(choice):
[...]
choice_handler()
```
You can supply the first argument with a boolean - if true, the function will run. Else, it won't.
If you supply the first argument with a function, you must supply the second argument with True.
Metadata
Release files for arbitrium 1.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| arbitrium-1.1.4.tar.gz | 3.1 kB | Without provenance | Details for arbitrium-1.1.4.tar.gz |
Release files / arbitrium-1.1.4.tar.gz
| Download URL | arbitrium-1.1.4.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d79263a6a11a4268db01e9a786f1a1ca8cccb961e030abd62b38b55422e7caa2
|
|
BLAKE2b-256 checksum How to use checksums |
1637164e3af21c0f067d843ef1576a8bb6a9aa6efbc0e05b174cd3fc2ae29fb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/38.4.0 requests-toolbelt/0.8.0 tqdm/4.28.0 CPython/3.6.4
|
Security for arbitrium 1.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.