Skip to main content

bsapi

A BrowserStack Rest Api Client

Build Status Documentation Status

Provides wrapper classes for the BrowserStack rest api

Setup


Set your username and key to environment variables.

export BROWSERSTACK_USERNAME = <your username>
export BROWSERSTACK_KEY = <your key>

or set them on the settings object

from bsapi import Settings

Settings.username = <your username>
Settings.password = <your key>

App Automate


Appium


Get the logs for a BrowserStack session

import os
from appium import webdriver
from bsapi.app_automate.appium import AppAutomateSession

username = os.getenv("BROWSERSTACK_USERNAME")
key = os.getenv("BROWSERSTACK_KEY")

desired_caps = {
    "build": "Python Android",
    "device": "Samsung Galaxy S8 Plus",
    "app": "<your app url>",
    "browserstack.networkLogs": "true",
    "browserstack.deviceLogs": "true",
    "browserstack.appiumLogs": "true",
    "browserstack.video": "true"
}

url = f"https://{username}:{key}@hub-cloud.browserstack.com/wd/hub"

driver = webdriver.Remote(url, desired_caps)
session_id = driver.session_id
driver.quit()

session = AppAutomateSession.by_id(session_id)
session.save_session_logs("session.log")
session.save_appium_logs("appium.log")
session.save_device_logs("device.log")
session.save_network_logs("network.log")
session.save_video("session.mp4")

Upload an application to BrowserStack

app = AppsApi.upload_app("MyApp.apk")

Get the badge key for a project

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)"

Metadata

Release files for bsapi 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bsapi 0.1.6
File Size Uploaded Provenance Actions
bsapi-0.1.6.tar.gz 29.3 kB Without provenance Details for bsapi-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bsapi 0.1.6
File Interpreter ABI Platform Actions
bsapi-0.1.6-py3-none-any.whl Python 3 none any Details for bsapi-0.1.6-py3-none-any.whl

Total release size: 61.4 kB

Release files / bsapi-0.1.6.tar.gz

Download URL bsapi-0.1.6.tar.gz
Size 29.3 kB
Tags Source
SHA-256 checksum
How to use checksums
54ac8cfda81e91274758bbb101ed8e471c23a83150e337ad160054a043d0ac21
BLAKE2b-256 checksum
How to use checksums
9a2e08107c1243fcf5815c04fc33137a1913d2993038d83a49344ec95af8d23b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.1

Release files / bsapi-0.1.6-py3-none-any.whl

Download URL bsapi-0.1.6-py3-none-any.whl
Size 32.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d0d626d1de459ca4be0255025c9787fe8b453086b218a2676b17cd02abda1333
BLAKE2b-256 checksum
How to use checksums
77193fbf7f92492c6d5e926f7c7586ca9463e6bf3fa5884d348ffb52b7ab8038
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.1

Security for bsapi 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page