Skip to main content

Python SDK for Browserness API

Project description

Browserness Python SDK

The official Python SDK for the Browserness API, allowing you to programmatically create and manage remote browser instances.

Installation

pip install browserness

Or if you're installing from source:

pip install .

Quick Start

import os
from browserness import Browserness
from browserness.core.api_error import ApiError

# Initialize the client
# Set your API key as an environment variable named BROWSERNESS_API_KEY
api_key = os.environ.get("BROWSERNESS_API_KEY")

client = Browserness(api_key=api_key)

try:
    # List all browsers (will fail without valid API key)
    browsers = client.browsers.list_browsers()
    print(browsers)
except ApiError as e:
    if e.status_code == 401:
        print("Authentication failed. Please set the BROWSERNESS_API_KEY environment variable.")
        print("You can get an API key at https://browserness.com")
    else:
        print(f"API Error: {e}")
except Exception as e:
    print(f"Unexpected error: {e}")

Async Support

The SDK also includes an async client:

import asyncio
import os
from browserness import AsyncBrowserness
from browserness.core.api_error import ApiError

async def main():
    # Initialize the async client
    # Set your API key as an environment variable named BROWSERNESS_API_KEY
    api_key = os.environ.get("BROWSERNESS_API_KEY")
    client = AsyncBrowserness(api_key=api_key)
    
    try:
        # List all browsers (will fail without valid API key)
        browsers = await client.browsers.list_browsers()
        print(browsers)
    except ApiError as e:
        if e.status_code == 401:
            print("Authentication failed. Please set the BROWSERNESS_API_KEY environment variable.")
            print("You can get an API key at https://browserness.com")
        else:
            print(f"API Error: {e}")
    except Exception as e:
        print(f"Unexpected error: {e}")

asyncio.run(main())

Documentation

For detailed documentation, please refer to the API documentation.

License

This SDK is licensed under the MIT License. See the LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

browserness-0.0.2.tar.gz (24.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

browserness-0.0.2-py3-none-any.whl (39.1 kB view details)

Uploaded Python 3

File details

Details for the file browserness-0.0.2.tar.gz.

File metadata

  • Download URL: browserness-0.0.2.tar.gz
  • Upload date:
  • Size: 24.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for browserness-0.0.2.tar.gz
Algorithm Hash digest
SHA256 c1146bfe1b75253d98b7bd1701cad3f977c30483e9598fd1725316f54fbfb3d7
MD5 d909ac657a9dd50b03357b3fc71eb49b
BLAKE2b-256 7cb3524d38693b31e718c469f9335c9bf91d04d8b46f7059403ed9a83f2d8600

See more details on using hashes here.

File details

Details for the file browserness-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: browserness-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 39.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.11

File hashes

Hashes for browserness-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 de403276e6e3c345a9098ca07414bb0ddad97139aac7e33005ae8ef611c3f50f
MD5 0f7e8d35c8e71848436bf9401a7a9c08
BLAKE2b-256 6c137a5f9727128f1b4c10492c71af69e79b53855510e3d56db1c8d662b14851

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page