Skip to content

Commit 71b8f45

Browse files
committed
update the file.py
1 parent e43c406 commit 71b8f45

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

zoomeye/file.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ def get_api_key(path) -> str:
2222
:param path:
2323
:return:
2424
"""
25-
key_file = zoomeye_dir + "/apikey"
25+
key_fl = zoomeye_dir + "/apikey"
2626
# api key config does not exits
2727
# raise FileNotFoundError
28-
if not os.path.exists(key_file):
28+
if not os.path.exists(key_fl):
2929
raise FileNotFoundError("not found api key config")
3030
# determine whether the permission of the configuration file is read-only,
3131
# if not, set it to read-only
32-
if not oct(os.stat(key_file).st_mode).endswith("600"):
33-
os.chmod(key_file, 0o600)
32+
if not oct(os.stat(key_fl).st_mode).endswith("600"):
33+
os.chmod(key_fl, 0o600)
3434
# return read file content
35-
with open(key_file, 'r') as f:
35+
with open(key_fl, 'r') as f:
3636
return f.read().strip()
3737

3838

@@ -42,18 +42,18 @@ def get_jwt_token(path) -> str:
4242
:param path:
4343
:return:
4444
"""
45-
key_file = zoomeye_dir + "/jwt"
45+
key_fl = zoomeye_dir + "/jwt"
4646
# json web token does not exits
4747
# raise FileNotFoundError
48-
if not os.path.exists(key_file):
48+
if not os.path.exists(key_fl):
4949
raise FileNotFoundError("not found access token config")
5050

5151
# determine whether the permission of the configuration file is read-only,
5252
# if not, set it to read-only
53-
if not oct(os.stat(key_file).st_mode).endswith("600"):
54-
os.chmod(key_file, 0o600)
53+
if not oct(os.stat(key_fl).st_mode).endswith("600"):
54+
os.chmod(key_fl, 0o600)
5555
# return read config content
56-
with open(key_file, 'r') as f:
56+
with open(key_fl, 'r') as f:
5757
return f.read().strip()
5858

5959

0 commit comments

Comments
 (0)