bleak


Namebleak JSON
Version 0.21.1 PyPI version JSON
download
home_pagehttps://github.com/hbldh/bleak
SummaryBluetooth Low Energy platform Agnostic Klient
upload_time2023-09-08 23:53:18
maintainer
docs_urlNone
authorHenrik Blidh
requires_python>=3.8,<3.13
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =====
bleak
=====

.. figure:: https://raw.githubusercontent.com/hbldh/bleak/master/Bleak_logo.png
    :target: https://github.com/hbldh/bleak
    :alt: Bleak Logo
    :scale: 50%


.. image:: https://github.com/hbldh/bleak/workflows/Build%20and%20Test/badge.svg
    :target: https://github.com/hbldh/bleak/actions?query=workflow%3A%22Build+and+Test%22
    :alt: Build and Test

.. image:: https://img.shields.io/pypi/v/bleak.svg
    :target: https://pypi.python.org/pypi/bleak

.. image:: https://img.shields.io/pypi/dm/bleak.svg
    :target: https://pypi.python.org/pypi/bleak
    :alt: PyPI - Downloads

.. image:: https://readthedocs.org/projects/bleak/badge/?version=latest
    :target: https://bleak.readthedocs.io/en/latest/?badge=latest
    :alt: Documentation Status

.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/black

Bleak is an acronym for Bluetooth Low Energy platform Agnostic Klient.

* Free software: MIT license
* Documentation: https://bleak.readthedocs.io.

Bleak is a GATT client software, capable of connecting to BLE devices
acting as GATT servers. It is designed to provide a asynchronous,
cross-platform Python API to connect and communicate with e.g. sensors.

Installation
------------

.. code-block:: bash

    $ pip install bleak

Features
--------

* Supports Windows 10, version 16299 (Fall Creators Update) or greater
* Supports Linux distributions with BlueZ >= 5.43
* OS X/macOS support via Core Bluetooth API, from at least OS X version 10.11
* Android backend compatible with python-for-android

Bleak supports reading, writing and getting notifications from
GATT servers, as well as a function for discovering BLE devices.

Usage
-----

To discover Bluetooth devices that can be connected to:

.. code-block:: python

    import asyncio
    from bleak import BleakScanner

    async def main():
        devices = await BleakScanner.discover()
        for d in devices:
            print(d)

    asyncio.run(main())


Connect to a Bluetooth device and read its model number:

.. code-block:: python

    import asyncio
    from bleak import BleakClient

    address = "24:71:89:cc:09:05"
    MODEL_NBR_UUID = "2A24"

    async def main(address):
        async with BleakClient(address) as client:
            model_number = await client.read_gatt_char(MODEL_NBR_UUID)
            print("Model Number: {0}".format("".join(map(chr, model_number))))

    asyncio.run(main(address))

DO NOT NAME YOUR SCRIPT ``bleak.py``! It will cause a circular import error.

See examples folder for more code, for instance example code for connecting to a
`TI SensorTag CC2650 <http://www.ti.com/ww/en/wireless_connectivity/sensortag/>`_


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hbldh/bleak",
    "name": "bleak",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<3.13",
    "maintainer_email": "",
    "keywords": "",
    "author": "Henrik Blidh",
    "author_email": "henrik.blidh@nedomkull.com",
    "download_url": "https://files.pythonhosted.org/packages/6a/c0/3aca655fa43b8ff5340d99fac4e67061f53f42f092fc847bdd0559d67846/bleak-0.21.1.tar.gz",
    "platform": null,
    "description": "=====\nbleak\n=====\n\n.. figure:: https://raw.githubusercontent.com/hbldh/bleak/master/Bleak_logo.png\n    :target: https://github.com/hbldh/bleak\n    :alt: Bleak Logo\n    :scale: 50%\n\n\n.. image:: https://github.com/hbldh/bleak/workflows/Build%20and%20Test/badge.svg\n    :target: https://github.com/hbldh/bleak/actions?query=workflow%3A%22Build+and+Test%22\n    :alt: Build and Test\n\n.. image:: https://img.shields.io/pypi/v/bleak.svg\n    :target: https://pypi.python.org/pypi/bleak\n\n.. image:: https://img.shields.io/pypi/dm/bleak.svg\n    :target: https://pypi.python.org/pypi/bleak\n    :alt: PyPI - Downloads\n\n.. image:: https://readthedocs.org/projects/bleak/badge/?version=latest\n    :target: https://bleak.readthedocs.io/en/latest/?badge=latest\n    :alt: Documentation Status\n\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n    :target: https://github.com/psf/black\n\nBleak is an acronym for Bluetooth Low Energy platform Agnostic Klient.\n\n* Free software: MIT license\n* Documentation: https://bleak.readthedocs.io.\n\nBleak is a GATT client software, capable of connecting to BLE devices\nacting as GATT servers. It is designed to provide a asynchronous,\ncross-platform Python API to connect and communicate with e.g. sensors.\n\nInstallation\n------------\n\n.. code-block:: bash\n\n    $ pip install bleak\n\nFeatures\n--------\n\n* Supports Windows 10, version 16299 (Fall Creators Update) or greater\n* Supports Linux distributions with BlueZ >= 5.43\n* OS X/macOS support via Core Bluetooth API, from at least OS X version 10.11\n* Android backend compatible with python-for-android\n\nBleak supports reading, writing and getting notifications from\nGATT servers, as well as a function for discovering BLE devices.\n\nUsage\n-----\n\nTo discover Bluetooth devices that can be connected to:\n\n.. code-block:: python\n\n    import asyncio\n    from bleak import BleakScanner\n\n    async def main():\n        devices = await BleakScanner.discover()\n        for d in devices:\n            print(d)\n\n    asyncio.run(main())\n\n\nConnect to a Bluetooth device and read its model number:\n\n.. code-block:: python\n\n    import asyncio\n    from bleak import BleakClient\n\n    address = \"24:71:89:cc:09:05\"\n    MODEL_NBR_UUID = \"2A24\"\n\n    async def main(address):\n        async with BleakClient(address) as client:\n            model_number = await client.read_gatt_char(MODEL_NBR_UUID)\n            print(\"Model Number: {0}\".format(\"\".join(map(chr, model_number))))\n\n    asyncio.run(main(address))\n\nDO NOT NAME YOUR SCRIPT ``bleak.py``! It will cause a circular import error.\n\nSee examples folder for more code, for instance example code for connecting to a\n`TI SensorTag CC2650 <http://www.ti.com/ww/en/wireless_connectivity/sensortag/>`_\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Bluetooth Low Energy platform Agnostic Klient",
    "version": "0.21.1",
    "project_urls": {
        "Changelog": "https://github.com/hbldh/bleak/blob/develop/CHANGELOG.rst",
        "Documentation": "https://bleak.readthedocs.io",
        "Homepage": "https://github.com/hbldh/bleak",
        "Issues": "https://github.com/hbldh/bleak/issues",
        "Support": "https://github.com/hbldh/bleak/discussions"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "084a7b6ff6710ec58f6709000b1fbc27b763e3921a1e5f23032aebe2531366fa",
                "md5": "c950c47503704cbb231c329fb32c674d",
                "sha256": "ccec260a0f5ec02dd133d68b0351c0151b2ecf3ddd0bcabc4c04a1cdd7f33256"
            },
            "downloads": -1,
            "filename": "bleak-0.21.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c950c47503704cbb231c329fb32c674d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<3.13",
            "size": 137842,
            "upload_time": "2023-09-08T23:53:17",
            "upload_time_iso_8601": "2023-09-08T23:53:17.480064Z",
            "url": "https://files.pythonhosted.org/packages/08/4a/7b6ff6710ec58f6709000b1fbc27b763e3921a1e5f23032aebe2531366fa/bleak-0.21.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6ac03aca655fa43b8ff5340d99fac4e67061f53f42f092fc847bdd0559d67846",
                "md5": "5e27e052efc45b64da1a1f017610c561",
                "sha256": "ec4a1a2772fb315b992cbaa1153070c7e26968a52b0e2727035f443a1af5c18f"
            },
            "downloads": -1,
            "filename": "bleak-0.21.1.tar.gz",
            "has_sig": false,
            "md5_digest": "5e27e052efc45b64da1a1f017610c561",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<3.13",
            "size": 118055,
            "upload_time": "2023-09-08T23:53:18",
            "upload_time_iso_8601": "2023-09-08T23:53:18.989916Z",
            "url": "https://files.pythonhosted.org/packages/6a/c0/3aca655fa43b8ff5340d99fac4e67061f53f42f092fc847bdd0559d67846/bleak-0.21.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-08 23:53:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hbldh",
    "github_project": "bleak",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "bleak"
}
        
Elapsed time: 0.11555s