Skip to content

Commit 3759638

Browse files
Renamings
1 parent df6b9df commit 3759638

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. "
@@ -475,20 +475,20 @@ def content_get(self, content_guid: str) -> ContentItemV1:
475475
response = self._server.handle_bad_response(response)
476476
return response
477477

478-
def get_content_by_id(self, app_id: str) -> ContentItemV1:
478+
def get_content_by_id(self, id: str) -> ContentItemV1:
479479
"""
480480
Get content by ID, which can be either a numeric ID (legacy) or GUID.
481481
482482
:param app_id: Either a numeric ID (e.g., "1234") or GUID (e.g., "abc-def-123")
483483
:return: ContentItemV1 data
484484
"""
485485
# Check if it looks like a GUID (contains hyphens)
486-
if "-" in str(app_id):
487-
return self.content_get(app_id)
486+
if "-" in str(id):
487+
return self.content_get(id)
488488
else:
489489
# Legacy numeric ID - get v0 content first to get GUID
490-
# TODO: deprecation warning
491-
app_v0 = self.app_get(app_id)
490+
app_v0 = self.app_get(id)
491+
# TODO: deprecation warning here
492492
return self.content_get(app_v0["guid"])
493493

494494
def content_create(self, name: str) -> ContentItemV1:
@@ -524,7 +524,9 @@ def content_build(
524524
response = self._server.handle_bad_response(response)
525525
return response
526526

527-
def content_deploy(self, app_guid: str, bundle_id: Optional[str] = None, activate: bool = True) -> BuildOutputDTO:
527+
def content_deploy(
528+
self, content_guid: str, bundle_id: Optional[str] = None, activate: bool = True
529+
) -> BuildOutputDTO:
528530
body: dict[str, str | bool | None] = {"bundle_id": bundle_id}
529531
if not activate:
530532
# The default behavior is to activate the app after deploying.
@@ -533,7 +535,7 @@ def content_deploy(self, app_guid: str, bundle_id: Optional[str] = None, activat
533535
body["activate"] = False
534536
response = cast(
535537
Union[BuildOutputDTO, HTTPResponse],
536-
self.post("v1/content/%s/deploy" % app_guid, body=body),
538+
self.post("v1/content/%s/deploy" % content_guid, body=body),
537539
)
538540
response = self._server.handle_bad_response(response)
539541
return response
@@ -598,7 +600,7 @@ def deploy(
598600

599601
app_guid = app["guid"]
600602
if env_vars:
601-
result = self.app_add_environment_vars(app_guid, list(env_vars.items()))
603+
result = self.add_environment_vars(app_guid, list(env_vars.items()))
602604
result = self._server.handle_bad_response(result)
603605

604606
if app["title"] != app_title and not title_is_default:
@@ -691,10 +693,6 @@ def output_task_log(
691693
log_callback(line)
692694

693695

694-
# for backwards compatibility with rsconnect-jupyter
695-
RSConnect = RSConnectClient
696-
697-
698696
class ServerDetailsPython(TypedDict):
699697
api_enabled: bool
700698
versions: list[str]
@@ -1183,7 +1181,7 @@ def verify_deployment(self):
11831181
raise RSConnectException("To verify deployment, client must be a RSConnectClient.")
11841182
deployed_info = self.deployed_info
11851183
app_guid = deployed_info["app_guid"]
1186-
self.client.app_access(app_guid)
1184+
self.client.access_content(app_guid)
11871185

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

0 commit comments

Comments
 (0)