| 1234567891011121314151617181920212223242526272829 |
- import os
- class apikey_generator:
- """
- This is ApiKey generator.
- """
- def __new__(cls) -> str:
- """
- It create new ApiKey, and return it as string.
-
- Returns:
- (str): New random ApiKey
- """
- random = os.urandom(cls.size())
- string = random.hex()
- return string
- def size() -> int:
- """
- It return size of ApiKey in bytes.
- Returns:
- (int): Size of ApiKey in bytes
- """
- return 128
|