2016-09-20 22:18:10 +00:00
|
|
|
"""
|
2016-10-25 16:19:14 +00:00
|
|
|
An interface to
|
2016-09-20 22:18:10 +00:00
|
|
|
"""
|
2016-10-25 16:19:14 +00:00
|
|
|
import requests
|
2016-09-21 20:54:22 +00:00
|
|
|
|
2016-09-20 22:18:10 +00:00
|
|
|
class ApiClient:
|
|
|
|
def __init__(self, host, port):
|
2016-09-21 20:54:22 +00:00
|
|
|
self.host = host
|
|
|
|
self.port = port
|
|
|
|
|
2016-10-25 16:19:14 +00:00
|
|
|
def url(self, url):
|
|
|
|
return "http://{}:{}{}".format(self.host, self.port, url)
|
|
|
|
|
2016-09-21 20:54:22 +00:00
|
|
|
def info(self):
|
2016-10-25 16:19:14 +00:00
|
|
|
return requests.get(self.url('/info')).json()
|
2016-09-21 22:07:19 +00:00
|
|
|
|
|
|
|
def options(self):
|
2016-10-25 16:19:14 +00:00
|
|
|
return requests.get(self.url('/options')).json()
|
2016-10-25 14:47:49 +00:00
|
|
|
|
|
|
|
def new_task(self):
|
2016-10-25 16:19:14 +00:00
|
|
|
pass
|
|
|
|
#print(dir(self.client.task.post_task_new))
|
|
|
|
#return self.client.task.post_task_new(images=dict(images="../Gruntfile.js")).result()
|
2016-10-25 14:47:49 +00:00
|
|
|
|
2016-10-25 16:19:14 +00:00
|
|
|
#a = ApiClient("localhostaa", 3000)
|
|
|
|
#print(a.info())
|