Skip to content

Commit

Permalink
refactor: replace random.choice by secrets.choice to avoid security r…
Browse files Browse the repository at this point in the history
…isks
  • Loading branch information
phanhongan committed Oct 26, 2024
1 parent 7227879 commit f27c9ed
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions examples/use-rdb-resource/make_example_table_data.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import random
import secrets

from dotenv import load_dotenv
from faker import Faker
Expand Down Expand Up @@ -67,8 +68,8 @@ def drop_table(self, table_class):
def generate_sales_data(session, num_records):
sales_data_list = []
for _ in range(num_records):
product = random.choice(products)
region = random.choice(regions)
product = secrets.choice(products)
region = secrets.choice(regions)
sale_date = fake.date_between(start_date='-1y', end_date='today')
sales_data = SalesData(
product_id=product["id"],
Expand Down

0 comments on commit f27c9ed

Please sign in to comment.