Sargon: Random Code Generator
sargon is a simple Python package (no external dependencies) to generate random (mnemonic) codes simulating Youtube or Heroku style. It's extensible to define your own rules too.
Basic usage
Heroku
heroku(code_length=4)
Heroku codes have the form ADJECTIVE-NOUN-CODE:
Example:
>>> from sargon import heroku
>>> heroku()
"valuable-period-6016"
>>> heroku(6)
"sweet-hat-673004"
YouTube
youtube(length=11, avoid_confusing_chars=False, blacklist_symbols=None)
Example:
>>> from sargon import youtube
>>> youtube()
"dQw4w9WgXcQ"
>>> youtube(6)
"LNb-P0"
>>> youtube(6, blacklist_symbols='-')
"LNbP0X"
6 Digit Generator
six_digit()
>>> from sargon import six_digit
>>> six_digit()
"770584"
Defining your own generators
Checkout engines.py for the list of available engines and the parameters they receive. Here's an example:
>>> from sargon import engines, build_generator
>>> generator = build_generator(
engines.CityWordEngine(country='United States'),
engines.NumberEngine(4))
>>> generator.generate()
"bellview-5269"
Why sargon?
I wanted to call the package Hammurabi, as the babylonian king that issued the Code of Hammurabi, but there's another package named hammurabi, so I went with another great ruler that I like to read about: Sargon the great the emperor of the Akkadian empire, what is thought today to be the first empire in history.
Metadata
Release files for sargon 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sargon-0.0.1.tar.gz | 114.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sargon-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 230.0 kB
Release files / sargon-0.0.1.tar.gz
| Download URL | sargon-0.0.1.tar.gz |
|---|---|
| Size | 114.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cbb59eb9e896a8c0042283c9ac6dd1138aba78b53fa709b81eb81173cced04c7
|
|
BLAKE2b-256 checksum How to use checksums |
f6aad53b0d276908f01bd35ac8fe22e824a61152f979db7f41661104cc6f17c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.0b8 CPython/3.8.0 Darwin/19.6.0
|
Release files / sargon-0.0.1-py3-none-any.whl
| Download URL | sargon-0.0.1-py3-none-any.whl |
|---|---|
| Size | 115.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b5327eed1fc55e95e885eb52389de2f6055a392700567885c606b694ceacbb79
|
|
BLAKE2b-256 checksum How to use checksums |
0ae18642cb14660ec42a421eb9d99acc39c5bc06d96d404ae512ae76bbabe86d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.0.0b8 CPython/3.8.0 Darwin/19.6.0
|