def get(self, metric, constraints):
     uri = self.baseUri + "/render?target=" + metric[
         1] + "&" + "from=" + self.renderFrom + "&format=json"
     print uri
     rest = RESTClient.RESTClient(uri)
     rest.get()
     return rest.json_body_load()
 def get(self):
     rest = RESTClient.RESTClient(self.uri)
     rest.get()
     tenants = []
     tdict = rest.json_body_load()['result']['groups']
     for t in tdict:
         tenants.append(Tenant(t['groupName'], self.uri))
     return tenants
class TestGetStockDetailsAPI:
	dp = dataParser("../inputs/stock_api.csv")
	dp.constructDataSet()
	rest_client = RESTClient("http","127.0.0.1","8081")
	
	def test_getStockQuoteAPIValidInputs(self):
		testdata = json.loads(self.dp.getTestCaseData("1"))
		test_url = testdata['base_url']+testdata['symbol']
		response_data = self.rest_client.makeGETRequest(test_url,"",None)
		assert response_data.status_code == 200
 def getHosts(self):
     rest = RESTClient.RESTClient(self.uri + "/hosts")
     rest.get()
     buff = rest.json_body_load()["result"]["groups"]
     print "***GET /HOSTS :" + rest.body
     try:
         result = []
         for h in buff[0]["paasMachines"]:
             result.append(h["machineName"])
     except:
         return None
     else:
         return Hosts.Hosts(result, self.name, self.uri)
 def getMetric(self, conf, metricName):
     uri = self.uri + conf.get("Metrics", metricName)
     print "GET METRIC " + uri
     rest = RESTClient.RESTClient(uri)
     rest.get()
     if rest.status_code == 200:
         value = rest.json_body_load(
         )["result"]["groups"][0]["paasMachines"][0]["services"][0][
             "paasMetrics"][0]["metricValue"]
         time = rest.json_body_load(
         )["result"]["groups"][0]["paasMachines"][0]["services"][0][
             "paasMetrics"][0]["metricTime"]
         metric = Metrics.Metric(self, metricName, time, value)
         return metric
Пример #6
0
import ImageAnalyzer as ia
import time
import RESTClient as rest

url = 'http://localhost:9090/AnalyticsServer/data'
while True:
    payload = ia.histogramCalc('coc1.jpg')
    #print ia.imageToBase64()
    payload = 'data='+payload
    rest.sendPOST(url,payload)
    time.sleep(1)
Пример #7
0
import ImageAnalyzer as ia
import time
import RESTClient as rest

url = 'http://localhost:9090/AnalyticsServer/data'
while True:
    payload = ia.histogramCalc('coc1.jpg')
    #print ia.imageToBase64()
    payload = 'data=' + payload
    rest.sendPOST(url, payload)
    time.sleep(1)
 def get(self):
     rest = RESTClient.RESTClient(self.uri)
     rest.get()
     return rest