Skip to content

Commit 8d865b8

Browse files
author
Ubuntu
committed
run code
1 parent 7acd8ff commit 8d865b8

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

bulk_user_creator.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,18 @@
33
from databunkerpro import DatabunkerproAPI
44

55
# Get credentials from environment
6-
api_url = os.getenv("DATABUNKER_API_URL", "https://pro.databunker.org")
7-
api_token = os.getenv("DATABUNKER_API_TOKEN", "")
6+
api_url = os.getenv("DATABUNKER_API_URL", "http://localhost")
7+
api_token = os.getenv("DATABUNKER_API_TOKEN", "9e8eebf1-060d-e3be-51f6-1d5da2d44f5b")
88
tenant_name = os.getenv("DATABUNKER_TENANT_NAME", "")
9+
print(api_token)
910

1011
def generate_random_user_data():
1112
"""Generate random user data with 120 fields."""
13+
userid = f"{random.randint(1000, 99999999999)}"
1214
# Base fields that are always present
1315
base_fields = {
14-
"email": f"user{random.randint(1000, 999999)}@example.com",
15-
"name": f"User {random.randint(1000, 999999)}",
16-
"phone": f"+1{random.randint(1000000000, 9999999999)}",
16+
"email": f"user{userid}@example.com",
17+
"name": f"User {userid}",
1718
}
1819

1920
# Additional fields to reach 120 fields
@@ -61,17 +62,14 @@ def create_bulk_users(api, num_batches=100, users_per_batch=100):
6162
return all_tokens
6263

6364
def main():
64-
65-
if not all([api_token, tenant_name]):
65+
if not all([api_token]):
6666
print("Error: DATABUNKER_API_TOKEN and DATABUNKER_TENANT_NAME environment variables must be set")
6767
return
68-
6968
# Initialize API client
7069
api = DatabunkerproAPI(api_url, api_token, tenant_name)
71-
7270
# Create users in bulk
7371
tokens = create_bulk_users(api)
7472
print(f"\nTotal tokens saved: {len(tokens)}")
7573

7674
if __name__ == "__main__":
77-
main()
75+
main()

0 commit comments

Comments
 (0)