Generator Utilities
gen_random_string(length=16, is_alphanum=True)
Generate secure random string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
length
|
int
|
Length of random string. Defaults to 16. |
16
|
is_alphanum
|
bool
|
If True, generate only alphanumeric string. Defaults to True. |
True
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Generated random string. |
Source code in src/potato_util/generator.py
gen_unique_id(prefix='')
Generate unique ID. Format: '{prefix}{datetime}_{uuid4}'.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prefix
|
str
|
Prefix of ID. Defaults to ''. |
''
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
Unique ID. |