From ab40bcfa26f7b129f23733ac605fb84bd0ec9f28 Mon Sep 17 00:00:00 2001 From: Aaron Lee Date: Sun, 26 Sep 2021 11:31:28 +0800 Subject: [PATCH] Change signature naming from random to defined --- app.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app.py b/app.py index bd98ab9..35f206f 100644 --- a/app.py +++ b/app.py @@ -7,7 +7,6 @@ import csv import os import pandas as pd import base64 -from random import randint from dotenv import load_dotenv import requests load_dotenv() @@ -307,7 +306,8 @@ def group_teach_publish(): formData.pop('notes') signature = signature.removeprefix('data:image/png;base64,') signature = bytes(signature, 'utf-8') - rand = str(randint(100000000000000, 999999999999999)) + rand = str(date + '^' + cclass['category'] + + '^' + cclass['class_id'] + '^' + period) rand += ".png" with open(os.path.join('temp', rand), "wb") as fh: fh.write(base64.decodebytes(signature)) @@ -355,7 +355,7 @@ def homeroom_abs_publish(): formData.pop('notes') signature = signature.removeprefix('data:image/png;base64,') signature = bytes(signature, 'utf-8') - rand = str(randint(100000000000000, 999999999999999)) + rand = str(date + '^' + homeroom[0] + '^' + homeroom[1] + '^' + period) rand += ".png" with open(os.path.join('temp', rand), "wb") as fh: fh.write(base64.decodebytes(signature))