-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
33 lines (27 loc) · 1.07 KB
/
settings.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import json
fileJson = f"src/settings.json"
def data_settings():
f = open(fileJson)
posts = json.load(f)
return posts
def mark_favorite_club(clubName=None, clubId=None, division=None):
with open(fileJson, 'r') as f:
my_list = json.load(f)
if len(clubId) == 0:
my_list['favorite_club'] = ''
my_list['favorite_club_id'] = ''
my_list['favorite_club_league_code'] = ''
else:
my_list['favorite_club'] = clubName
my_list['favorite_club_id'] = clubId
my_list['favorite_club_league_code'] = division
with open(fileJson, 'w') as f:
f.write(json.dumps(my_list, separators=(',',': '), indent=4))
return
def cache_time(hours=None):
with open(fileJson, 'r') as f:
my_list = json.load(f)
my_list['cache_time_hours'] = hours
with open(fileJson, 'w') as f:
f.write(json.dumps(my_list, separators=(',',': '), indent=4))
return