Skyvern/skyvern/utils/strings.py
LawyZheng 988416829f
Some checks are pending
Run tests and pre-commit / Run tests and pre-commit hooks (push) Waiting to run
Run tests and pre-commit / Frontend Lint and Build (push) Waiting to run
Publish Fern Docs / run (push) Waiting to run
shorten random string for secret value (#3263)
2025-08-22 01:23:26 +08:00

11 lines
289 B
Python

import os
import random
import string
RANDOM_STRING_POOL = string.ascii_letters + string.digits
def generate_random_string(length: int = 5) -> str:
# Use the os.urandom(16) as the seed
random.seed(os.urandom(16))
return "".join(random.choices(RANDOM_STRING_POOL, k=length))