mirror of
https://github.com/r4sas/PBinCLI
synced 2025-02-03 18:34:39 +00:00
handle errors when trying to get instance jsonld schema
Signed-off-by: R4SAS <r4sas@i2pmail.org>
This commit is contained in:
parent
8c5f93487a
commit
3f30828e1a
@ -81,14 +81,19 @@ class PrivateBin:
|
|||||||
|
|
||||||
|
|
||||||
def getVersion(self):
|
def getVersion(self):
|
||||||
jsonldSchema = self.session.get(
|
result = self.session.get(
|
||||||
url = self.server + '?jsonld=paste',
|
url = self.server + '?jsonld=paste',
|
||||||
headers = self.headers).json()
|
headers = self.headers)
|
||||||
return jsonldSchema['@context']['v']['@value'] \
|
try:
|
||||||
if ('@context' in jsonldSchema and
|
jsonldSchema = result.json()
|
||||||
'v' in jsonldSchema['@context'] and
|
return jsonldSchema['@context']['v']['@value'] \
|
||||||
'@value' in jsonldSchema['@context']['v']) \
|
if ('@context' in jsonldSchema and
|
||||||
else 1
|
'v' in jsonldSchema['@context'] and
|
||||||
|
'@value' in jsonldSchema['@context']['v']) \
|
||||||
|
else 1
|
||||||
|
except ValueError:
|
||||||
|
PBinCLIError("Unable parse response as json. Received (size = {}):\n{}".format(len(result.text), result.text))
|
||||||
|
|
||||||
|
|
||||||
def getServer(self):
|
def getServer(self):
|
||||||
return self.server
|
return self.server
|
||||||
|
Loading…
x
Reference in New Issue
Block a user