Threatthriver commited on
Commit
4729829
1 Parent(s): f9e8b5c

Update api.py

Browse files
Files changed (1) hide show
  1. api.py +8 -7
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 generate_and_save_api_key(user_id):
25
- """Generate an API key and save it."""
26
- api_key = generate_api_key()
27
- save_api_key(user_id, api_key)
28
- print(f"API Key for {user_id}: {api_key}")
 
 
29
 
30
  if __name__ == "__main__":
31
- user_id = input("Enter user ID: ")
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)