blob: f1603b9d01452ba6f3a94241f12376f3ae250e29 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import sys
import requests
from python_moonutilities import exceptions
def get(url):
try:
response = requests.get(url)
except requests.exceptions.RequestException as e:
raise exceptions.ConsulError("request failure ",e)
except:
raise exceptions.ConsulError("Unexpected error ", sys.exc_info()[0])
return response
def put(url, json=""):
try:
response = requests.put(url,json=json)
except requests.exceptions.RequestException as e:
raise exceptions.ConsulError("request failure ",e)
except:
raise exceptions.ConsulError("Unexpected error ", sys.exc_info()[0])
return response
|