Skip to content

Commit

Permalink
Add generate_random_string function to API config
Browse files Browse the repository at this point in the history
  • Loading branch information
campb303 committed Jun 16, 2021
1 parent c17647d commit 0d38b4f
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions src/webqueue2api/api/config.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,30 @@
"""Stores API configuartion data."""
from dataclasses import dataclass
import random, string



def generate_random_string(length=16) -> str:
"""Generate random string of letters and numbers of specified length.
Example:
generate_random_string() -> "aud04ki947rrje3k9"
Args:
length (int, optional): Number of characters to generate. Defaults to 16.
Returns:
str: Random string.
"""
possible_characters = string.ascii_letters + string.digits + "!@#$%^&*"
random_string = ''
for number in range(length):
random_string += random.choice(possible_characters)
return random_string

@dataclass
class Configuraton:
pass


config = Configuraton(

)

0 comments on commit 0d38b4f

Please sign in to comment.