blob: edaeb17781a9eff2aa101d74a76054214ffb66c8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import logging
import copy
import requests
from python_moonclient.core import config
LOGGER = logging.getLogger("moonclient.core.export_json")
URL = None
HEADERS = None
def init(consul_host, consul_port):
conf_data = config.get_config_data(consul_host, consul_port)
global URL, HEADERS
URL = "http://{}:{}".format(
conf_data['manager_host'],
conf_data['manager_port'])
URL = URL + "{}"
HEADERS = {"content-type": "application/json"}
def export_to_json():
req = requests.get(URL.format("/export"))
req.raise_for_status()
result = req.json()
return result
|