Metadata-Version: 2.5
Name: xbox-devportal
Version: 0.1.0
Summary: Async client for the Xbox (Series/One) Windows Device Portal in Developer Mode
Author: Hudson Brendon
License: MIT
Requires-Python: >=3.12
Requires-Dist: aiohttp>=3.9
Description-Content-Type: text/markdown

# xbox-devportal

Async client for the Xbox (Series/One) Windows Device Portal in Developer Mode.

## Installation

```bash
pip install xbox-devportal
```

## Quick Start

```python
import asyncio
from xbox_devportal import XboxDevPortal

async def main():
    client = XboxDevPortal("10.0.0.5", username="user", password="pass")
    
    # Fetch device info
    info = await client.info()
    print(f"Device: {info.computer_name} ({info.os_version})")
    
    # Close the connection
    await client.close()

asyncio.run(main())
```

## API Reference

### Device Information

| Method | Returns | Description |
|--------|---------|-------------|
| `info()` | `DeviceInfo` | Device name, OS version, platform |
| `system_perf()` | `SystemPerf` | CPU load, memory, GPU metrics |
| `processes()` | `list[Process]` | All running processes with memory usage |
| `foreground_app()` | `Process \| None` | Currently active non-shell application |
| `screenshot()` | `bytes` | PNG screenshot of current display |

### Apps & Packages

| Method | Returns | Description |
|--------|---------|-------------|
| `packages(sideloaded_only=False)` | `list[Package]` | Installed packages; filter by `sideloaded_only` |
| `launch(package)` | `None` | Launch an app by package name or object |
| `terminate(package)` | `None` | Terminate a running app |
| `install(local_path)` | `None` | Install APPX; polls state until complete or error (60-cycle timeout) |
| `uninstall(package_full_name)` | `None` | Uninstall package by full name |

### File System (LocalAppData)

| Method | Returns | Description |
|--------|---------|-------------|
| `list_files(package_full_name, path)` | `list[dict]` | List files in app's LocalState (e.g., `//LocalState`) |
| `upload_file(package_full_name, path, local_path, remote_name=None)` | `None` | Upload file to app directory |
| `delete_file(package_full_name, path, filename)` | `None` | Delete file from app directory |

### Device Control

| Method | Returns | Description |
|--------|---------|-------------|
| `settings()` | `dict[str, Setting]` | All device settings with options |
| `set_setting(name, value)` | `None` | Set device setting (e.g., power mode) |
| `sandbox()` | `str` | Current Xbox Live sandbox |
| `smb_credentials()` | `SmbShare` | SMB share path, username, password |
| `restart()` | `None` | Restart the device |
| `shutdown()` | `None` | Shut down the device |

## Security Notes

- **Self-Signed Certificate**: The Device Portal uses HTTPS with a self-signed certificate. The client disables SSL verification by default (`ssl=False`). Use only over a trusted network.
  
- **Basic Authentication**: Credentials are sent via Basic Auth (base64-encoded). Use only on a LAN behind a firewall. Do not expose the Device Portal port (default 11443) to the internet.

## License

MIT
