Skip to content

Commit b50835e

Browse files
author
Naor Livne
committed
reply from sdk is now only the message body with the correct type rather then the entire request response
1 parent a04b6bc commit b50835e

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

NebulaPythonSDK/sdk.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,49 +25,49 @@ def create_app(self, app, config):
2525
payload = json.dumps(config)
2626
headers = self.headers
2727
response = requests.request("POST", url, data=payload, headers=headers, timeout=self.request_timeout)
28-
return response
28+
return json.dumps(response.json())
2929

3030
# delete an existing nebula app, no confirmation required in SDK so be careful
3131
def delete_app(self, app):
3232
url = self.host + "/api/apps/" + app
3333
headers = self.headers
3434
response = requests.request("DELETE", url, headers=headers, timeout=self.request_timeout)
35-
return response
35+
return json.dumps(response.json())
3636

3737
# list all of the apps managed by nebula
3838
def list_apps(self):
3939
url = self.host + "/api/apps"
4040
headers = self.headers
4141
response = requests.request("GET", url, headers=headers, timeout=self.request_timeout)
42-
return response
42+
return json.dumps(response.json()["apps"])
4343

4444
# list the config of a nebula app, only requires the app name
4545
def list_app_info(self, app):
4646
url = self.host + "/api/apps/" + app
4747
headers = self.headers
4848
response = requests.request("GET", url, headers=headers, timeout=self.request_timeout)
49-
return response
49+
return json.dumps(response.json())
5050

5151
# stop a nebula app, only requires the app name
5252
def stop_app(self, app):
5353
url = self.host + "/api/apps/" + app + "/stop"
5454
headers = self.headers
5555
response = requests.request("POST", url, headers=headers, timeout=self.request_timeout)
56-
return response
56+
return json.dumps(response.json())
5757

5858
# start a nebula app, only requires the app name
5959
def start_app(self, app):
6060
url = self.host + "/api/apps/" + app + "/start"
6161
headers = self.headers
6262
response = requests.request("POST", url, headers=headers, timeout=self.request_timeout)
63-
return response
63+
return json.dumps(response.json())
6464

6565
# restart a nebula app, only requires the app name
6666
def restart_app(self, app):
6767
url = self.host + "/api/apps/" + app + "/restart"
6868
headers = self.headers
6969
response = requests.request("POST", url, headers=headers, timeout=self.request_timeout)
70-
return response
70+
return json.dumps(response.json())
7171

7272
# update a nebula app, requires the app name and a dict of the config values you want to change, any combination of
7373
# config values is accepted as it keeps the rest unchanged
@@ -76,18 +76,18 @@ def update_app(self, app, config):
7676
payload = json.dumps(config)
7777
headers = self.headers
7878
response = requests.request("PUT", url, data=payload, headers=headers, timeout=self.request_timeout)
79-
return response
79+
return json.dumps(response.json())
8080

8181
# rolling restart an app, only requires the app name
8282
def roll_app(self, app):
8383
url = self.host + "/api/apps/" + app + "/roll"
8484
headers = self.headers
8585
response = requests.request("POST", url, headers=headers, timeout=self.request_timeout)
86-
return response
86+
return json.dumps(response.json())
8787

8888
# check that the contacted api is responding as expected
8989
def check_api(self):
9090
url = self.host + "/api/status"
9191
headers = self.headers
9292
response = requests.request("GET", url, headers=headers, timeout=self.request_timeout)
93-
return response
93+
return json.dumps(response.json())

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ app_conf = {
5050
}
5151
connection.create_app("app_name", app_conf)
5252

53-
```
53+
```

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
__author__ = 'Naor Livne'
22
__author_email__ = 'naorlivne@gmail.com'
3-
__version__ = '1.4.0'
3+
__version__ = '1.5.0'
44

55
from setuptools import setup, find_packages
66

0 commit comments

Comments
 (0)