updated syncthing module
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
7f8fff52da
commit
d596a23267
@ -35,9 +35,12 @@ def get_config(url="http://localhost:8384", verify=False, apikey=get_apikey()):
|
|||||||
req = Request(method="GET",
|
req = Request(method="GET",
|
||||||
url=fullurl)
|
url=fullurl)
|
||||||
req.add_header("X-API-Key", apikey)
|
req.add_header("X-API-Key", apikey)
|
||||||
|
try:
|
||||||
res = urlopen(req, context=get_context(verify))
|
res = urlopen(req, context=get_context(verify))
|
||||||
|
|
||||||
ret = json.loads(res.read())
|
ret = json.loads(res.read())
|
||||||
|
except urllib.error.URLError:
|
||||||
|
return None
|
||||||
if res.status == 200:
|
if res.status == 200:
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
@ -58,6 +61,8 @@ def set_config_options(url="http://localhost:8384", verify=False, apikey=get_api
|
|||||||
return False
|
return False
|
||||||
req.full_url = urljoin(url, err.headers['Location'])
|
req.full_url = urljoin(url, err.headers['Location'])
|
||||||
res = urlopen(req, context=get_context(verify))
|
res = urlopen(req, context=get_context(verify))
|
||||||
|
except urllib.error.URLError:
|
||||||
|
return None
|
||||||
if res.status == 200:
|
if res.status == 200:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -79,6 +84,8 @@ def set_config_gui(url="http://localhost:8384", verify=False, apikey=get_apikey(
|
|||||||
res = urlopen(req, context=get_context(verify))
|
res = urlopen(req, context=get_context(verify))
|
||||||
except http.client.RemoteDisconnected as err:
|
except http.client.RemoteDisconnected as err:
|
||||||
return True
|
return True
|
||||||
|
except urllib.error.URLError:
|
||||||
|
return None
|
||||||
if res.status == 200:
|
if res.status == 200:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -99,6 +106,8 @@ def _set_config(url="http://localhost:8384", verify=False, apikey=get_apikey(),
|
|||||||
return None
|
return None
|
||||||
req.full_url = urljoin(url, err.headers['Location'])
|
req.full_url = urljoin(url, err.headers['Location'])
|
||||||
res = urlopen(req, context=get_context(verify))
|
res = urlopen(req, context=get_context(verify))
|
||||||
|
except urllib.error.URLError:
|
||||||
|
return None
|
||||||
if res.status == 200:
|
if res.status == 200:
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@ -110,10 +119,13 @@ def insync(url="http://localhost:8384", verify=False, apikey=get_apikey()):
|
|||||||
req = Request(method="GET",
|
req = Request(method="GET",
|
||||||
url=fullurl)
|
url=fullurl)
|
||||||
req.add_header("X-API-Key", apikey)
|
req.add_header("X-API-Key", apikey)
|
||||||
|
try:
|
||||||
res = urlopen(req, context=get_context(verify))
|
res = urlopen(req, context=get_context(verify))
|
||||||
ret = json.loads(res.read())
|
ret = json.loads(res.read())
|
||||||
if res.status == 200:
|
if res.status == 200:
|
||||||
return ret
|
return ret
|
||||||
|
except urllib.error.URLError:
|
||||||
|
return None
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -123,8 +135,11 @@ def restart(url="http://localhost:8384", verify=False, apikey=get_apikey()):
|
|||||||
req = Request(method="POST",
|
req = Request(method="POST",
|
||||||
url=fullurl)
|
url=fullurl)
|
||||||
req.add_header("X-API-Key", apikey)
|
req.add_header("X-API-Key", apikey)
|
||||||
|
try:
|
||||||
res = urlopen(req, context=get_context(verify))
|
res = urlopen(req, context=get_context(verify))
|
||||||
if res.status == 200:
|
if res.status == 200:
|
||||||
return {}
|
return {}
|
||||||
|
except urllib.error.URLError:
|
||||||
|
return None
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
Loading…
Reference in New Issue
Block a user