Skip to content

Commit 8b6e53d

Browse files
committed
use get application API when calling get_rstudio_app_info
1 parent cdbe078 commit 8b6e53d

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

rsconnect/api.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def handle_bad_response(self, response):
5252
response.full_uri,
5353
response.json_data["error"],
5454
)
55+
raise Exception(error)
5556
raise RSConnectException(error)
5657
if response.status < 200 or response.status > 299:
5758
raise RSConnectException(
@@ -249,7 +250,7 @@ def deploy(self, app_id, app_name, app_title, title_is_default, tarball, env_var
249250
try:
250251
self._server.handle_bad_response(app)
251252
except RSConnectException as e:
252-
raise RSConnectException(f"{e} Try setting the --new flag to overwrite the previous deployment.")
253+
raise RSConnectException(f"{e} Try setting the --new flag to overwrite the previous deployment.") from e
253254

254255
app_guid = app["guid"]
255256
if env_vars:
@@ -847,15 +848,15 @@ def validate_app_mode(self, *args, **kwargs):
847848
except RSConnectException as e:
848849
raise RSConnectException(
849850
f"{e} Try setting the --new flag to overwrite the previous deployment."
850-
)
851+
) from e
851852
elif isinstance(self.remote_server, PositServer):
852853
try:
853854
app = get_rstudio_app_info(self.remote_server, app_id)
854855
existing_app_mode = AppModes.get_by_cloud_name(app["mode"])
855856
except RSConnectException as e:
856857
raise RSConnectException(
857858
f"{e} Try setting the --new flag to overwrite the previous deployment."
858-
)
859+
) from e
859860
else:
860861
raise RSConnectException("Unable to infer Connect client.")
861862
if existing_app_mode and existing_app_mode not in (None, AppModes.UNKNOWN, app_mode):
@@ -1485,8 +1486,11 @@ def get_app_info(connect_server, app_id):
14851486

14861487
def get_rstudio_app_info(server, app_id):
14871488
with PositClient(server) as client:
1488-
response = client.get_content(app_id)
1489-
return response["source"]
1489+
if isinstance(server, ShinyappsServer):
1490+
return client.get_application(app_id)
1491+
else:
1492+
response = client.get_content(app_id)
1493+
return response["source"]
14901494

14911495

14921496
def get_app_config(connect_server, app_id):

0 commit comments

Comments
 (0)