mirror of
https://github.com/r4sas/PBinCLI
synced 2025-03-12 21:31:19 +00:00
fix codacy issues
Signed-off-by: r4sas <r4sas@i2pmail.org>
This commit is contained in:
parent
fb7a93732d
commit
f838f8ee94
@ -119,10 +119,10 @@ class Shortener:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
result.raise_for_status()
|
result.raise_for_status()
|
||||||
except HTTPError as http_exc:
|
except HTTPError:
|
||||||
try:
|
try:
|
||||||
response = result.json()
|
response = result.json()
|
||||||
except:
|
except ValueError:
|
||||||
PBinCLIError("YOURLS: Unable parse response. Received (size = {}):\n{}".format(len(result.text), result.text))
|
PBinCLIError("YOURLS: Unable parse response. Received (size = {}):\n{}".format(len(result.text), result.text))
|
||||||
else:
|
else:
|
||||||
PBinCLIError("YOURLS: Received error from API: {} with JSON {}".format(result, response))
|
PBinCLIError("YOURLS: Received error from API: {} with JSON {}".format(result, response))
|
||||||
@ -130,11 +130,7 @@ class Shortener:
|
|||||||
response = result.json()
|
response = result.json()
|
||||||
|
|
||||||
if {'status', 'code', 'message'} <= set(response.keys()):
|
if {'status', 'code', 'message'} <= set(response.keys()):
|
||||||
status = response['status']
|
if response['status'] == 'fail':
|
||||||
code = response['code']
|
|
||||||
message = response['message']
|
|
||||||
|
|
||||||
if status == 'fail':
|
|
||||||
PBinCLIError("YOURLS: Received error from API: {}".format(response['message']))
|
PBinCLIError("YOURLS: Received error from API: {}".format(response['message']))
|
||||||
if not 'shorturl' in response:
|
if not 'shorturl' in response:
|
||||||
PBinCLIError("YOURLS: Unknown error: {}".format(response['message']))
|
PBinCLIError("YOURLS: Unknown error: {}".format(response['message']))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user