airtop


Nameairtop JSON
Version 0.0.27 PyPI version JSON
download
home_pageNone
SummarySDK for Airtop cloud browsers
upload_time2024-12-11 22:04:44
maintainerNone
docs_urlNone
authorNone
requires_python<4.0,>=3.8
licenseMIT
keywords airtop ai cloud browser automation agent python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Airtop Python Library

[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fairtop-ai%2Fairtop-python-sdk)
[![pypi](https://img.shields.io/pypi/v/airtop)](https://pypi.python.org/pypi/airtop)

The Airtop Python library provides convenient access to the Airtop API from Python.

## Installation

```sh
pip install airtop
```

## Reference

A full reference for this library is available [here](./reference.md).

## Usage

Instantiate and use the client with the following:

```python
from airtop import Airtop

client = Airtop(
    api_key="YOUR_API_KEY",
)
client.windows.create(
    session_id="6aac6f73-bd89-4a76-ab32-5a6c422e8b0b",
)
```

## Async Client

The SDK also exports an `async` client so that you can make non-blocking calls to our API.

```python
import asyncio

from airtop import AsyncAirtop

client = AsyncAirtop(
    api_key="YOUR_API_KEY",
)


async def main() -> None:
    await client.windows.create(
        session_id="6aac6f73-bd89-4a76-ab32-5a6c422e8b0b",
    )


asyncio.run(main())
```

## Exception Handling

When the API returns a non-success status code (4xx or 5xx response), a subclass of the following error
will be thrown.

```python
from airtop.core.api_error import ApiError

try:
    client.windows.create(...)
except ApiError as e:
    print(e.status_code)
    print(e.body)
```

## Streaming

The SDK supports streaming responses, as well, the response will be a generator that you can loop over.

```python
from airtop import Airtop

client = Airtop(
    api_key="YOUR_API_KEY",
)
response = client.sessions.events(
    id="string",
)
for chunk in response:
    yield chunk
```

## Advanced

### Retries

The SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long
as the request is deemed retriable and the number of retry attempts has not grown larger than the configured
retry limit (default: 2).

A request is deemed retriable when any of the following HTTP status codes is returned:

- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)
- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)
- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)

Use the `max_retries` request option to configure this behavior.

```python
client.windows.create(..., request_options={
        "max_retries": 1
    })
    ```

### Timeouts

The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.

```python

    from airtop import Airtop

client = Airtop(
    ...,
    timeout=20.0,
)


    # Override timeout for a specific method
    client.windows.create(..., request_options={
        "timeout_in_seconds": 1
    })
    ```

### Custom Client

You can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies
and transports.
```python
import httpx
from airtop import Airtop

client = Airtop(
    ...,
    httpx_client=httpx.Client(
        proxies="http://my.test.proxy.example.com",
        transport=httpx.HTTPTransport(local_address="0.0.0.0"),
    ),
)
```

## Contributing

While we value open-source contributions to this SDK, this library is generated programmatically.
Additions made directly to this library would have to be moved over to our generation code,
otherwise they would be overwritten upon the next generated release. Feel free to open a PR as
a proof of concept, but know that we will not be able to merge it as-is. We suggest opening
an issue first to discuss with us!

On the other hand, contributions to the README are always very welcome!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "airtop",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "airtop, ai, cloud, browser, automation, agent, python",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/70/46/4ddaac147b22cad77e9c9dc18023f85ba9399f055f62256cfa0c79cae1c1/airtop-0.0.27.tar.gz",
    "platform": null,
    "description": "# Airtop Python Library\n\n[![fern shield](https://img.shields.io/badge/%F0%9F%8C%BF-Built%20with%20Fern-brightgreen)](https://buildwithfern.com?utm_source=github&utm_medium=github&utm_campaign=readme&utm_source=https%3A%2F%2Fgithub.com%2Fairtop-ai%2Fairtop-python-sdk)\n[![pypi](https://img.shields.io/pypi/v/airtop)](https://pypi.python.org/pypi/airtop)\n\nThe Airtop Python library provides convenient access to the Airtop API from Python.\n\n## Installation\n\n```sh\npip install airtop\n```\n\n## Reference\n\nA full reference for this library is available [here](./reference.md).\n\n## Usage\n\nInstantiate and use the client with the following:\n\n```python\nfrom airtop import Airtop\n\nclient = Airtop(\n    api_key=\"YOUR_API_KEY\",\n)\nclient.windows.create(\n    session_id=\"6aac6f73-bd89-4a76-ab32-5a6c422e8b0b\",\n)\n```\n\n## Async Client\n\nThe SDK also exports an `async` client so that you can make non-blocking calls to our API.\n\n```python\nimport asyncio\n\nfrom airtop import AsyncAirtop\n\nclient = AsyncAirtop(\n    api_key=\"YOUR_API_KEY\",\n)\n\n\nasync def main() -> None:\n    await client.windows.create(\n        session_id=\"6aac6f73-bd89-4a76-ab32-5a6c422e8b0b\",\n    )\n\n\nasyncio.run(main())\n```\n\n## Exception Handling\n\nWhen the API returns a non-success status code (4xx or 5xx response), a subclass of the following error\nwill be thrown.\n\n```python\nfrom airtop.core.api_error import ApiError\n\ntry:\n    client.windows.create(...)\nexcept ApiError as e:\n    print(e.status_code)\n    print(e.body)\n```\n\n## Streaming\n\nThe SDK supports streaming responses, as well, the response will be a generator that you can loop over.\n\n```python\nfrom airtop import Airtop\n\nclient = Airtop(\n    api_key=\"YOUR_API_KEY\",\n)\nresponse = client.sessions.events(\n    id=\"string\",\n)\nfor chunk in response:\n    yield chunk\n```\n\n## Advanced\n\n### Retries\n\nThe SDK is instrumented with automatic retries with exponential backoff. A request will be retried as long\nas the request is deemed retriable and the number of retry attempts has not grown larger than the configured\nretry limit (default: 2).\n\nA request is deemed retriable when any of the following HTTP status codes is returned:\n\n- [408](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) (Timeout)\n- [429](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) (Too Many Requests)\n- [5XX](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) (Internal Server Errors)\n\nUse the `max_retries` request option to configure this behavior.\n\n```python\nclient.windows.create(..., request_options={\n        \"max_retries\": 1\n    })\n    ```\n\n### Timeouts\n\nThe SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.\n\n```python\n\n    from airtop import Airtop\n\nclient = Airtop(\n    ...,\n    timeout=20.0,\n)\n\n\n    # Override timeout for a specific method\n    client.windows.create(..., request_options={\n        \"timeout_in_seconds\": 1\n    })\n    ```\n\n### Custom Client\n\nYou can override the `httpx` client to customize it for your use-case. Some common use-cases include support for proxies\nand transports.\n```python\nimport httpx\nfrom airtop import Airtop\n\nclient = Airtop(\n    ...,\n    httpx_client=httpx.Client(\n        proxies=\"http://my.test.proxy.example.com\",\n        transport=httpx.HTTPTransport(local_address=\"0.0.0.0\"),\n    ),\n)\n```\n\n## Contributing\n\nWhile we value open-source contributions to this SDK, this library is generated programmatically.\nAdditions made directly to this library would have to be moved over to our generation code,\notherwise they would be overwritten upon the next generated release. Feel free to open a PR as\na proof of concept, but know that we will not be able to merge it as-is. We suggest opening\nan issue first to discuss with us!\n\nOn the other hand, contributions to the README are always very welcome!\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "SDK for Airtop cloud browsers",
    "version": "0.0.27",
    "project_urls": null,
    "split_keywords": [
        "airtop",
        " ai",
        " cloud",
        " browser",
        " automation",
        " agent",
        " python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5ec487004425bdc9096b9e08c34593164a95aca1e82e765a157807fe657204df",
                "md5": "bb42387c95d176c0d1d5ce8419098863",
                "sha256": "29f2b3f7dc9ca6907b4128a0a9b8ad8b0d809a07e919b2281be3cefc2edb8fa2"
            },
            "downloads": -1,
            "filename": "airtop-0.0.27-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bb42387c95d176c0d1d5ce8419098863",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 82024,
            "upload_time": "2024-12-11T22:04:41",
            "upload_time_iso_8601": "2024-12-11T22:04:41.954744Z",
            "url": "https://files.pythonhosted.org/packages/5e/c4/87004425bdc9096b9e08c34593164a95aca1e82e765a157807fe657204df/airtop-0.0.27-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "70464ddaac147b22cad77e9c9dc18023f85ba9399f055f62256cfa0c79cae1c1",
                "md5": "dd2bf6263f7860f0f71ddf2e66cf8416",
                "sha256": "ecbadf5b131bb1c59672b5d49a6c6d63e98f2bbd7b2a67bcb063ccce4d014c63"
            },
            "downloads": -1,
            "filename": "airtop-0.0.27.tar.gz",
            "has_sig": false,
            "md5_digest": "dd2bf6263f7860f0f71ddf2e66cf8416",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 44836,
            "upload_time": "2024-12-11T22:04:44",
            "upload_time_iso_8601": "2024-12-11T22:04:44.074311Z",
            "url": "https://files.pythonhosted.org/packages/70/46/4ddaac147b22cad77e9c9dc18023f85ba9399f055f62256cfa0c79cae1c1/airtop-0.0.27.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-11 22:04:44",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "airtop"
}
        
Elapsed time: 0.40262s