generate token using hex chars Args: length: length of token - default 32 Returns: token string
(length=32)
| 195 | |
| 196 | |
| 197 | def generate_token(length=32): |
| 198 | """ |
| 199 | generate token using hex chars |
| 200 | |
| 201 | Args: |
| 202 | length: length of token - default 32 |
| 203 | |
| 204 | Returns: |
| 205 | token string |
| 206 | """ |
| 207 | return "".join(random.choice("0123456789abcdef") for _ in range(length)) |
| 208 | |
| 209 | |
| 210 | def byte_to_str(data): |
no outgoing calls