Projects Api

class bsapi.app_automate.appium.projects.ProjectsApi
classmethod delete(project_id=None)

Delete the project from BrowserStack. You must remove all builds from the project first.

Example:

project = ProjectsApi.details(project_id)
for build in project.builds:
    message = BuildsApi.delete(build.hashed_id)
    if message.status == "ok":
        print(f"Deleted: {build.name}")
    else:
        print(f"{build.name} - {message.message}"
message = ProjectsApi.delete(project_id)
if message.status == "ok":
    print(f"{project.name} has been deleted")
else:
    print(f"{project.name} - {message.message}"
Parameters

project_id – Project ID to be deleted

Returns

Deleted response message

Return type

responses.DeleteResponse

classmethod details(project_id=None)

Get the details for a project including recent builds

Example:

projects = ProjectsApi.get_recent()
for project in projects:
    project = ProjectsApi.details(project.project_id)
    for build in project.builds:
        print(f"{project.name} - {build.name}: {build.status}")
Parameters

project_id – Project ID

Returns

Project including recent builds

Return type

Project

classmethod recent_projects(limit=None, offset=None, status=None)

Get recent projects from BrowserStack

Example:

projects = ProjectsApi.recent_projects(limit=20)
for project in projects:
    print(project.name)
Parameters
  • limit (int) – Number of items to return

  • offset (int) – Number of items to skip

  • status (str) – Return only items in this status

Returns

List of recent projects

Return type

list[Project]

classmethod status_badge_key(project_id=None)

Get the status badge for the project

Example:

projects = ProjectsApi.recent_projects()
project = [p for p in projects if p.name == "My Project"][0]
badge_key = ProjectsApi.get_badge_key(project.project_id)
badge_markdown = f"[![BrowserStack Status](https://app-automate.browserstack.com/badge.svg?badge_key=<badge_key>)](https://app-automate.browserstack.com/public-build/{badge_key}?redirect=true)"
Parameters

project_id – Project ID

Returns

Status Badge Key

Return type

str

classmethod update_project_name(project_id=None, name=None)

Update the name of the project on BrowserStack

Example:

projects = ProjectsApi.recent_projects()
project = [p for p in projects if p.name = "My Test Project"][0]
updated_project = ProjectsApi.update_project_name(project.project_id, "New Test Project Name")
Parameters
  • project_id – Project ID

  • name – New name for the project

Returns

updated project

Return type

Project