fix: [app:requests] Catch if request failed
This commit is contained in:
parent
a417e09b0f
commit
8ea636065c
6 changed files with 42 additions and 35 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -12,7 +12,6 @@ lerna-debug.log*
|
||||||
|
|
||||||
node_modules
|
node_modules
|
||||||
.DS_Store
|
.DS_Store
|
||||||
dist
|
|
||||||
dist-ssr
|
dist-ssr
|
||||||
coverage
|
coverage
|
||||||
*.local
|
*.local
|
||||||
|
|
File diff suppressed because one or more lines are too long
2
dist/index.html
vendored
2
dist/index.html
vendored
|
@ -5,7 +5,7 @@
|
||||||
<link rel="icon" href="/favicon.ico">
|
<link rel="icon" href="/favicon.ico">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Vite App</title>
|
<title>Vite App</title>
|
||||||
<script type="module" crossorigin src="/assets/index-CrmZ3McV.js"></script>
|
<script type="module" crossorigin src="/assets/index-DNFQtfBp.js"></script>
|
||||||
<link rel="stylesheet" crossorigin href="/assets/index-CIUN73PR.css">
|
<link rel="stylesheet" crossorigin href="/assets/index-CIUN73PR.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
|
@ -19,7 +19,10 @@ def get(url, data={}, api_key=misp_apikey):
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
}
|
}
|
||||||
full_url = urljoin(misp_url, url)
|
full_url = urljoin(misp_url, url)
|
||||||
|
try:
|
||||||
response = requests.get(full_url, data=data, headers=headers, verify=not misp_skipssl)
|
response = requests.get(full_url, data=data, headers=headers, verify=not misp_skipssl)
|
||||||
|
except requests.exceptions.ConnectionError:
|
||||||
|
return None
|
||||||
return response.json() if response.headers['content-type'].startswith('application/json') else response.text
|
return response.json() if response.headers['content-type'].startswith('application/json') else response.text
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,7 +34,10 @@ def post(url, data={}, api_key=misp_apikey):
|
||||||
"Content-Type": "application/json"
|
"Content-Type": "application/json"
|
||||||
}
|
}
|
||||||
full_url = urljoin(misp_url, url)
|
full_url = urljoin(misp_url, url)
|
||||||
|
try:
|
||||||
response = requests.post(full_url, data=json.dumps(data), headers=headers, verify=not misp_skipssl)
|
response = requests.post(full_url, data=json.dumps(data), headers=headers, verify=not misp_skipssl)
|
||||||
|
except requests.exceptions.ConnectionError:
|
||||||
|
return None
|
||||||
return response.json() if response.headers['content-type'].startswith('application/json') else response.text
|
return response.json() if response.headers['content-type'].startswith('application/json') else response.text
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -157,4 +157,4 @@ if __name__ == "__main__":
|
||||||
eventlet.spawn_n(forward_zmq_to_socketio)
|
eventlet.spawn_n(forward_zmq_to_socketio)
|
||||||
|
|
||||||
# Run the Socket.IO server
|
# Run the Socket.IO server
|
||||||
eventlet.wsgi.server(eventlet.listen(('0.0.0.0', 4000)), app)
|
eventlet.wsgi.server(eventlet.listen(('127.0.0.1', 4000)), app)
|
||||||
|
|
|
@ -93,6 +93,7 @@
|
||||||
</span>
|
</span>
|
||||||
</h4>
|
</h4>
|
||||||
|
|
||||||
|
<template v-if="diagnosticLoading || isMISPOnline">
|
||||||
<h4 class="font-semibold ml-1"><strong>MISP Settings:</strong></h4>
|
<h4 class="font-semibold ml-1"><strong>MISP Settings:</strong></h4>
|
||||||
<div class="ml-3">
|
<div class="ml-3">
|
||||||
<div v-if="diagnosticLoading" class="flex justify-center">
|
<div v-if="diagnosticLoading" class="flex justify-center">
|
||||||
|
@ -116,6 +117,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue