Showing
4 changed files
with
60 additions
and
3 deletions
check_policy.py
0 → 100644
1 | +import hashlib | ||
2 | +from firebase_admin import db | ||
3 | +from firebase_admin import credentials | ||
4 | +import firebase_admin | ||
5 | +import csv | ||
6 | + | ||
7 | + | ||
8 | +cred = credentials.Certificate('wello_firebase_SDKKey.json') | ||
9 | +firebase_admin.initialize_app(cred, {'databaseURL': 'https://capstone-vip.firebaseio.com/'}) | ||
10 | +ref = db.reference() | ||
11 | +policies = ref.get() | ||
12 | + | ||
13 | +## compare dict | ||
14 | +policy_dict = dict() | ||
15 | + | ||
16 | +def policy_hash_writer(policies): | ||
17 | + with open('./hash_policy.csv', 'w', encoding='utf-8', newline='') as csvfile: | ||
18 | + wr = csv.writer(csvfile) | ||
19 | + | ||
20 | + for policy in policies: | ||
21 | + sha = hashlib.sha256() | ||
22 | + sha.update(str(policy).encode('utf-8')) | ||
23 | + wr.writerow([policy["Value"], sha.hexdigest()]) | ||
24 | + | ||
25 | + | ||
26 | +def policy_db_reader(): | ||
27 | + for policy in policies: | ||
28 | + if policy["Value"] in policy_dict.keys(): | ||
29 | + sha = hashlib.sha256() | ||
30 | + sha.update(str(policy).encode('utf-8')) | ||
31 | + if policy_dict[policy["Value"]] != sha.hexdigest(): | ||
32 | + print("change contents : ", policy["Value"], ".", policy["Policy"]) | ||
33 | + else: | ||
34 | + print("new policy : ", policy["Value"], ". ", policy["Policy"]) | ||
35 | + | ||
36 | + | ||
37 | +def policy_hash_reader(): | ||
38 | + with open('./hash_policy.csv', 'r', encoding='utf-8') as csvfile: | ||
39 | + rdr = csv.reader(csvfile) | ||
40 | + | ||
41 | + for r in rdr: | ||
42 | + policy_dict[r[0]] = r[1] | ||
43 | + | ||
44 | +#policy_hash_writer(policies) | ||
45 | +policy_hash_reader() | ||
46 | +policy_db_reader() |
... | @@ -5,14 +5,14 @@ from D_dayCalculator import D_day | ... | @@ -5,14 +5,14 @@ from D_dayCalculator import D_day |
5 | import json | 5 | import json |
6 | 6 | ||
7 | cred = credentials.Certificate('wello_firebase_SDKKey.json') | 7 | cred = credentials.Certificate('wello_firebase_SDKKey.json') |
8 | -firebase_admin.initialize_app(cred, {'databaseURL': 'https://wello-pocliy-temp.firebaseio.com/'}) | 8 | +firebase_admin.initialize_app(cred, {'databaseURL': 'https://capstone-vip.firebaseio.com/'}) |
9 | ref = db.reference() | 9 | ref = db.reference() |
10 | 10 | ||
11 | policies = ref.get() | 11 | policies = ref.get() |
12 | date = D_day("1970.01.01") | 12 | date = D_day("1970.01.01") |
13 | 13 | ||
14 | -with open('view_count_raw.json', 'rt', encoding='utf-8') as json_file: | 14 | +#with open('view_count_raw.json', 'rt', encoding='utf-8') as json_file: |
15 | - view_count = json.load(json_file) | 15 | +# view_count = json.load(json_file) |
16 | 16 | ||
17 | 17 | ||
18 | for policy in policies: | 18 | for policy in policies: | ... | ... |
hash_policy.csv
0 → 100644
1 | +0,d24548533c984425a9a96cbd23e0085baed58a16d26d2764ee3e08f4ec9f2713 | ||
2 | +1,4f2e40e552527f48278fa2cdfadfa34e61c5a1672d82dc2ff42fcb4bff484cc2 | ||
3 | +2,7f41b893ec6ca567b928f9ba975c87e31db98a14fa6bc1c28431ab3a244cca43 | ||
4 | +3,fb6094dc6ba8c21846557664fda37a808f9877f35f301c444194b484e6cf38ae | ||
5 | +4,121b23de7cf0d313077a208739b7a202ddfe6442c3f62dd2ed0cb475411c3bb8 | ||
6 | +5,26e05536f3fc6a844af4a746ecd070157180e4787fb122cf18b5dc8b91d2ff63 | ||
7 | +6,2809644d986b0226b080fdffbe7d3d1453095a12984101edbaefbf61821a8848 | ||
8 | +7,c7e3ac97575b1006424d0f2a391df327dc249067f0361d604355700bbe780102 | ||
9 | +8,3d7f2a439aa277c88101b08d2af865d6610f9791b614d9bbcce5a5f424736bb5 | ||
10 | +9,fba861e8ecc5f5411dec793409f8a98a96cbbb738fba74be397294e288dc7a4b |
... | @@ -14,6 +14,7 @@ | ... | @@ -14,6 +14,7 @@ |
14 | 14 | ||
15 | <style name="SplashTheme" parent="Theme.AppCompat.NoActionBar"> | 15 | <style name="SplashTheme" parent="Theme.AppCompat.NoActionBar"> |
16 | <item name="android:windowBackground">@drawable/background_splash</item> | 16 | <item name="android:windowBackground">@drawable/background_splash</item> |
17 | + <item name="android:scaleType">fitXY</item> | ||
17 | </style> | 18 | </style> |
18 | 19 | ||
19 | <style name="EditTheme" > | 20 | <style name="EditTheme" > | ... | ... |
-
Please register or login to post a comment