Skip to content

Commit a54addd

Browse files
Renamings
1 parent 8673d1f commit a54addd

File tree

1 file changed

+18
-20
lines changed

1 file changed

+18
-20
lines changed

rsconnect/api.py

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -426,22 +426,22 @@ def app_get(self, app_id: str) -> ContentItemV0:
426426
response = self._server.handle_bad_response(response)
427427
return response
428428

429-
def app_add_environment_vars(self, app_guid: str, env_vars: list[tuple[str, str]]):
429+
def add_environment_vars(self, content_guid: str, env_vars: list[tuple[str, str]]):
430430
env_body = [dict(name=kv[0], value=kv[1]) for kv in env_vars]
431-
return self.patch("v1/content/%s/environment" % app_guid, body=env_body)
431+
return self.patch("v1/content/%s/environment" % content_guid, body=env_body)
432432

433-
def is_app_failed_response(self, response: HTTPResponse | JsonData) -> bool:
433+
def is_failed_response(self, response: HTTPResponse | JsonData) -> bool:
434434
return isinstance(response, HTTPResponse) and response.status >= 500
435435

436-
def app_access(self, app_guid: str) -> None:
436+
def access_content(self, content_guid: str) -> None:
437437
method = "GET"
438438
base = dirname(self._url.path) # remove __api__
439-
path = f"{base}/content/{app_guid}/"
439+
path = f"{base}/content/{content_guid}/"
440440
response = self._do_request(method, path, None, None, 3, {}, False)
441441

442-
if self.is_app_failed_response(response):
442+
if self.is_failed_response(response):
443443
# Get content metadata to construct logs URL
444-
content = self.content_get(app_guid)
444+
content = self.content_get(content_guid)
445445
logs_url = content["dashboard_url"] + "/logs"
446446
raise RSConnectException(
447447
"Could not access the deployed content. "
@@ -467,20 +467,20 @@ def content_get(self, content_guid: str) -> ContentItemV1:
467467
response = self._server.handle_bad_response(response)
468468
return response
469469

470-
def get_content_by_id(self, app_id: str) -> ContentItemV1:
470+
def get_content_by_id(self, id: str) -> ContentItemV1:
471471
"""
472472
Get content by ID, which can be either a numeric ID (legacy) or GUID.
473473
474474
:param app_id: Either a numeric ID (e.g., "1234") or GUID (e.g., "abc-def-123")
475475
:return: ContentItemV1 data
476476
"""
477477
# Check if it looks like a GUID (contains hyphens)
478-
if "-" in str(app_id):
479-
return self.content_get(app_id)
478+
if "-" in str(id):
479+
return self.content_get(id)
480480
else:
481481
# Legacy numeric ID - get v0 content first to get GUID
482-
# TODO: deprecation warning
483-
app_v0 = self.app_get(app_id)
482+
app_v0 = self.app_get(id)
483+
# TODO: deprecation warning here
484484
return self.content_get(app_v0["guid"])
485485

486486
def content_create(self, name: str) -> ContentItemV1:
@@ -516,7 +516,9 @@ def content_build(
516516
response = self._server.handle_bad_response(response)
517517
return response
518518

519-
def content_deploy(self, app_guid: str, bundle_id: Optional[str] = None, activate: bool = True) -> BuildOutputDTO:
519+
def content_deploy(
520+
self, content_guid: str, bundle_id: Optional[str] = None, activate: bool = True
521+
) -> BuildOutputDTO:
520522
body: dict[str, str | bool | None] = {"bundle_id": bundle_id}
521523
if not activate:
522524
# The default behavior is to activate the app after deploying.
@@ -525,7 +527,7 @@ def content_deploy(self, app_guid: str, bundle_id: Optional[str] = None, activat
525527
body["activate"] = False
526528
response = cast(
527529
Union[BuildOutputDTO, HTTPResponse],
528-
self.post("v1/content/%s/deploy" % app_guid, body=body),
530+
self.post("v1/content/%s/deploy" % content_guid, body=body),
529531
)
530532
response = self._server.handle_bad_response(response)
531533
return response
@@ -590,7 +592,7 @@ def deploy(
590592

591593
app_guid = app["guid"]
592594
if env_vars:
593-
result = self.app_add_environment_vars(app_guid, list(env_vars.items()))
595+
result = self.add_environment_vars(app_guid, list(env_vars.items()))
594596
result = self._server.handle_bad_response(result)
595597

596598
if app["title"] != app_title and not title_is_default:
@@ -683,10 +685,6 @@ def output_task_log(
683685
log_callback(line)
684686

685687

686-
# for backwards compatibility with rsconnect-jupyter
687-
RSConnect = RSConnectClient
688-
689-
690688
class ServerDetailsPython(TypedDict):
691689
api_enabled: bool
692690
versions: list[str]
@@ -1175,7 +1173,7 @@ def verify_deployment(self):
11751173
raise RSConnectException("To verify deployment, client must be a RSConnectClient.")
11761174
deployed_info = self.deployed_info
11771175
app_guid = deployed_info["app_guid"]
1178-
self.client.app_access(app_guid)
1176+
self.client.access_content(app_guid)
11791177

11801178
@cls_logged("Validating app mode...")
11811179
def validate_app_mode(self, app_mode: AppMode):

0 commit comments

Comments
 (0)