semvec/pypi-packages huggingface dataset:
expmiband2 0.1.3
Python API for communicating with MiBand2
Requires Python: >=3.5

# MiBand2 Python API based on bleak

The library provides convenient APIs to control and read data of MiBand2.

## Supported features

- sending notifications
- date/time setup and reading
- onetime alarm setup
- reading battery level

## Usage

```
import asyncio
import bleak
from miband2 import Band2, Key, NotificationType as NT
from datetime import datetime

KEY = Key(
    key=b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x05',
    reset=True # note *
)

async def main():
    located_band = await scan_bands(timeout=15)
    client = bleak.BleakClient(located_band, timeout=15)
    
    async with Band2(client) as band:
        auth_status = await band.auth(KEY)
        print(f"auth status: {auth_status}")

        battery_level = await band.get_battery()
        print(f"battery: {battery_level}")

        await band.ring(NT.SINGLE)
        
        now = datetime.now()
        await band.set_datetime(now)

async def scan_bands(timeout):
    def bands_only(dev, adv):
        return "MI Band" in dev.name
    return await bleak.BleakScanner.find_device_by_filter(timeout=timeout, filterfunc=bands_only)

asyncio.run(main())
```
_Note: key reset is required for the first time only. Later, one can auth with the same key setting the `reset=False`_

## Why?

This project initially helped me to learn BLE.
My old Band2 got its second life when I started to learn BLE and became curious if I can communicate with the device using a Linux machine. This Band2 device acted as an oracle visually confirming if I craft packets correctly. The fact of a visual feedback in a form of a notification or displaying a newly set time provided some incentive to me and made learning funnier than it could be if relying solely on reading books.
selenium-assist 0.3.5
Helper functions for Selenium
Requires Python: >=3.7

# selenium-assist

[![PyPI](https://img.shields.io/pypi/v/selenium-assist)](https://pypi.org/project/selenium-assist/)
[![PyPI - License](https://img.shields.io/pypi/l/selenium-assist)](https://github.com/ivanmicetic/selenium-assist/blob/main/LICENSE)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

Python package for easy writing of Selenium scripts.

Implemented helper functions:
- connect_webdriver
- load_page
- wait_for_presence
- wait_for_visibility
- click_element
- send_keys
- hoover_over_element
- switch_to_iframe
- get_table_data
- get_element_text
- execute_script

## install
```bash
pip install selenium-assist
```

## usage
```python
import time
import selenium_assist as sa
from selenium.webdriver.common.keys import Keys
import logging


# setup and silence loggers
logging.basicConfig(level=logging.DEBUG)
logging.getLogger("selenium.webdriver.remote.remote_connection").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.WARNING)

# connect webdriver (use False for headless mode)
driver = sa.connect_webdriver(True)

# do stuff
sa.load_page("Loading initial webpage ...", "https://google.com/ncr", driver)
sa.wait_for_presence("Waiting for Accept all ...", '//*[@id="L2AGLb"]', driver, extra_timeout=1)
sa.click_element("Clicking Accept all ...", '//*[@id="L2AGLb"]', driver)
sa.wait_for_presence("Waiting for Google Search ...", '//*[@id="APjFqb"]', driver)
sa.click_element("Clicking search box ...", '//*[@id="APjFqb"]', driver)
sa.send_keys("Sending text ...", '//*[@id="APjFqb"]', "news" + Keys.ENTER, driver, skip_check=True)

# close webdriver
logging.debug("Done with webdriver, sleeping 3s and exiting ...")
time.sleep(3)
driver.close()
```