Skip to content

Commit

Permalink
feat: rrocr 添加
Browse files Browse the repository at this point in the history
  • Loading branch information
mikumifa committed Jun 10, 2024
1 parent 4231e4a commit 2ef7ad1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions util/config_util.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import json
import time

import requests
from loguru import logger
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
Expand Down Expand Up @@ -95,13 +94,19 @@ def get_cookies_str_force(self):
return cookies_str

def get_config_value(self, name, default=None):
with open(self.config_file_path, "r") as f:
self.config = json.load(f)
return self.config.get(name, default)
try:
with open(self.config_file_path, "r") as f:
self.config = json.load(f)
return self.config.get(name, default)
except Exception:
return default

def set_config_value(self, name, value):
with open(self.config_file_path, "r") as f:
self.config = json.load(f)
try:
with open(self.config_file_path, "r") as f:
self.config = json.load(f)
except Exception:
self.config = {}
self.config[name] = value
self.dump_config()

Expand Down

0 comments on commit 2ef7ad1

Please sign in to comment.