Spaces:
Runtime error
Runtime error
Threatthriver
commited on
Commit
•
4729829
1
Parent(s):
f9e8b5c
Update api.py
Browse files
api.py
CHANGED
@@ -21,12 +21,13 @@ def save_api_key(user_id, api_key):
|
|
21 |
with open(API_KEYS_FILE, 'w') as f:
|
22 |
json.dump(api_keys, f)
|
23 |
|
24 |
-
def
|
25 |
-
"""Generate
|
26 |
-
|
27 |
-
|
28 |
-
|
|
|
|
|
29 |
|
30 |
if __name__ == "__main__":
|
31 |
-
|
32 |
-
generate_and_save_api_key(user_id)
|
|
|
21 |
with open(API_KEYS_FILE, 'w') as f:
|
22 |
json.dump(api_keys, f)
|
23 |
|
24 |
+
def generate_and_save_api_keys(num_keys=15):
|
25 |
+
"""Generate and save a specified number of API keys."""
|
26 |
+
for i in range(1, num_keys + 1):
|
27 |
+
user_id = f"user_{i}"
|
28 |
+
api_key = generate_api_key()
|
29 |
+
save_api_key(user_id, api_key)
|
30 |
+
print(f"API Key for {user_id}: {api_key}")
|
31 |
|
32 |
if __name__ == "__main__":
|
33 |
+
generate_and_save_api_keys(15)
|
|