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")
# If you have an API key, you can pass it in the headers
headers = {"Authorization": f"Bearer {api_key}"} if api_key else None
client = Browserness(headers=headers)
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")
headers = {"Authorization": f"Bearer {api_key}"} if api_key else None
client = AsyncBrowserness(headers=headers)
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file browserness-0.0.3.tar.gz.
File metadata
- Download URL: browserness-0.0.3.tar.gz
- Upload date:
- Size: 27.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee9c7b600e932568e22986142a20bb7d1a95af6be645a204fcd8b2a58071f38a
|
|
| MD5 |
36c16eed1ab139098fa7bc53ce4b5e31
|
|
| BLAKE2b-256 |
e887fe698a3f30087040549d9929d4b873c9f95f4e8bf2956e8a0557bb36849c
|
File details
Details for the file browserness-0.0.3-py3-none-any.whl.
File metadata
- Download URL: browserness-0.0.3-py3-none-any.whl
- Upload date:
- Size: 38.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
58a45519a45b1510e3c53a5bd92b551f36ac1f9867736d55f5a8cb97806707a7
|
|
| MD5 |
6fa6a1b7ddf0714d2ad37ddf181f094f
|
|
| BLAKE2b-256 |
731c606a1de5d57e3ea759999924324c789050c4db0085cfd94cae7085c766cc
|