semvec/pypi-packages huggingface dataset:
ytmd-sdk 1.0.1
A Python SDK for interacting with the YouTube Music Desktop App.
Requires Python: >=3.8
Keywords: youtube, music, desktop, sdk, api, ytmd, ytmd-sdk, youtube-music, youtube-music-desktop, youtube-music-desktop-app

# Youtube Music Desktop SDK
Simple SDK for controlling [Youtube Music Desktop App](https://ytmdesktop.app/).

## Installation
`pip install ytmd-sdk`

## Example
```python
from YTMDSDK import Events, YTMD, Parser
from time import sleep

ytmd = YTMD("touchportalytmd", "TouchPortalYTMD", "1.0.0")

key = ytmd.authenticate() # get token key and sets it at same time
# ytmd.update_token("token") # if you already have a token key you can set it like this

def on_connect():
    print("Connected to YTMD")

def on_disconnect():
    print("Disconnected from YTMD")

def on_error(data):
    print("Error from YTMD: " + data)

def on_state_update(data):
    parser = Parser(data)
    print("Player: " + str(parser.player_state))
    print("Player State: " + parser.player_state.state)
    print("Player video progress: " + str(parser.player_state.video_progress))
    print("Player volume: " + str(parser.player_state.volume))
    print("Player muted: " + str(parser.player_state.muted))
    print("Player ad playing: " + str(parser.player_state.adPlaying))
    print("Player auto play: " + str(parser.player_state.auto_play))
    print("Player is generating: " + str(parser.player_state.isGenerating))
    print("Player is infinite: " + str(parser.player_state.isInfinite))
    print("Player repeat mode: " + parser.player_state.repeatMode)
    print("Player selected item index: " + str(parser.player_state.selectedItemIndex))
    print("Player queue: " + str(parser.player_state.queue))

ytmd.register_event(Events.connect, on_connect)
ytmd.register_event(Events.disconnect, on_disconnect)
ytmd.register_event(Events.error, on_error)
ytmd.register_event(Events.state_update, on_state_update)

ytmd.connect()
sleep(60)
```

## Change Log
```
- 1.0.0: Initial release
```

## Bugs and Suggestions
If you have any bugs or suggestions, feel free to open an issue or a pull request.
func-az 0.1.9
Tools for Azure Functions
Requires Python: >=3.10

# func-az

> Simple tools for Azure Functions

```bash
pip install func-az
```

## Safe Start-up

Sometimes you deploy a function, and it breaks. And you have no idea why.

```python
import azure.functions as func
import func_az as fz

def make() -> func.FunctionApp:
  ...

def handle_err(exc):
  logging.error(f'An error occurred during startup: {exc}')
  return 'An error occurred'

app = fz.startup(make, error_message=handle_err)
```

If it breaks, it sets up a `/health` route that you can use to trigger the handler.


## Scheduled Job

You can set up a timer trigger, and also an HTTP trigger. But not both. This bridges the gap:

```python
import azure.functions as func
import func_az as fz

app = func.FunctionApp()

@fz.job(app, 'greet-users', route='greet', timer='0 */5 * * * *')
async def greet_users():
  ...
```

Runs at the given timer, or can be triggered at `/greet`.