Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions zoomeye/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
zoomeye_dir = os.path.expanduser(config.ZOOMEYE_CONFIG_PATH)


def key_init(key):
def init_key(key):
"""
initialize through the api key, write the api key to the local configuration file,
theoretically it will never expire unless you remake the api key
Expand Down Expand Up @@ -52,7 +52,7 @@ def init(args):
api_key = args.apikey
# use api key init
if api_key:
key_init(api_key)
init_key(api_key)
return
# invalid parameter
show.printf("input parameter error", color="red")
Expand Down
3 changes: 3 additions & 0 deletions zoomeye/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
zoomeye_dir = os.path.expanduser(config.ZOOMEYE_CONFIG_PATH)




def get_api_key(path) -> str:
"""
obtain api key from local configuration when querying data
Expand Down Expand Up @@ -48,6 +50,7 @@ def get_jwt_token(path) -> str:
if not os.path.exists(key_file):
raise FileNotFoundError("not found access token config")


# determine whether the permission of the configuration file is read-only,
# if not, set it to read-only
if not oct(os.stat(key_file).st_mode).endswith("600"):
Expand Down