mirror of
https://github.com/blw1138/Zordon.git
synced 2025-12-17 16:58:12 +00:00
Use alphanumeric API tokens instead of ints
This commit is contained in:
@@ -3,6 +3,7 @@ import os
|
||||
import platform
|
||||
import shutil
|
||||
import socket
|
||||
import string
|
||||
import subprocess
|
||||
from datetime import datetime
|
||||
|
||||
@@ -156,3 +157,19 @@ def is_localhost(comparison_hostname):
|
||||
return comparison_hostname == local_hostname
|
||||
except AttributeError:
|
||||
return False
|
||||
|
||||
|
||||
def num_to_alphanumeric(num):
|
||||
# List of possible alphanumeric characters
|
||||
characters = string.ascii_letters + string.digits
|
||||
|
||||
# Make sure number is positive
|
||||
num = abs(num)
|
||||
|
||||
# Convert number to alphanumeric
|
||||
result = ""
|
||||
while num > 0:
|
||||
num, remainder = divmod(num, len(characters))
|
||||
result += characters[remainder]
|
||||
|
||||
return result[::-1] # Reverse the result to get the correct alphanumeric string
|
||||
|
||||
Reference in New Issue
Block a user