Skip to content

Commit

Permalink
Update request setting methods to be optionally used as setters
Browse files Browse the repository at this point in the history
  • Loading branch information
MoojMidge committed Sep 22, 2024
1 parent 446fbe5 commit f77d606
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion resources/lib/youtube_plugin/kodion/network/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class BaseRequestsClass(object):
def __init__(self, context, exc_type=None):
settings = context.get_settings()
self._verify = settings.verify_ssl()
self._timeout = settings.get_timeout()
self._timeout = settings.requests_timeout()
self._proxy = settings.proxy_settings()

if isinstance(exc_type, tuple):
Expand Down
12 changes: 10 additions & 2 deletions resources/lib/youtube_plugin/kodion/settings/abstract_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,22 @@ def safe_search(self):
def age_gate(self):
return self.get_bool(SETTINGS.AGE_GATE, True)

def verify_ssl(self):
def verify_ssl(self, value=None):
if value is not None:
return self.set_bool(SETTINGS.VERIFY_SSL, value)

if sys.version_info <= (2, 7, 9):
verify = False
else:
verify = self.get_bool(SETTINGS.VERIFY_SSL, True)
return verify

def get_timeout(self):
def requests_timeout(self, value=None):
if value is not None:
self.set_int(SETTINGS.CONNECT_TIMEOUT, value[0])
self.set_int(SETTINGS.READ_TIMEOUT, value[1])
return value

connect_timeout = self.get_int(SETTINGS.CONNECT_TIMEOUT, 9) + 0.5
read_timout = self.get_int(SETTINGS.READ_TIMEOUT, 27)
return connect_timeout, read_timout
Expand Down

0 comments on commit f77d606

Please sign in to comment.