pia-ctl-sdk


Namepia-ctl-sdk JSON
Version 0.1.3 PyPI version JSON
download
home_pageNone
SummaryTyped mini-SDK for the PIA `piactl` CLI with env settings, strategy connect, async monitor, and proxy adapters.
upload_time2025-10-10 07:44:11
maintainerNone
docs_urlNone
authorNone
requires_python==3.13.*
licenseMIT
keywords pia vpn piactl proxy playwright selenium httpx pydantic
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pia-ctl-sdk

[![PyPI - Version](https://img.shields.io/pypi/v/pia-ctl-sdk.svg)](https://pypi.org/project/pia-ctl-sdk/)
[![PyPI - Downloads](https://img.shields.io/pypi/dm/pia-ctl-sdk.svg)](https://pypi.org/project/pia-ctl-sdk/)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
[![Python - Version](https://img.shields.io/badge/python-3.13-blue.svg)](https://www.python.org/downloads/)
[![CI - Release](https://github.com/pr1m8/pia-ctl/actions/workflows/release.yml/badge.svg)](https://github.com/pr1m8/pia-ctl/actions/workflows/release.yml)
[![Code Style - Ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)
[![Type Checking - mypy](https://img.shields.io/badge/types-mypy-2A6DB2.svg)](http://mypy-lang.org/)
[![Docs - GitHub Pages](https://img.shields.io/badge/docs-mkdocs--material-blue)](https://pr1m8.github.io/pia-ctl/)

A **typed Python SDK** for the Private Internet Access (PIA) VPN CLI (`piactl`) with comprehensive environment management, proxy adapters, and automation capabilities.

## 🚀 Features

- **🔒 VPN Management**: Connect, disconnect, and monitor PIA VPN connections
- **⚙️ Environment Configuration**: Pydantic v2 settings with `.env` file support
- **🌐 Proxy Adapters**: Built-in support for Playwright, httpx, and Selenium
- **📊 Status Monitoring**: Real-time VPN status and connection monitoring
- **🎯 Smart Connection**: Strategy-based connection (preferred → random → default regions)
- **🔌 Plugin System**: Extensible plugin architecture for custom functionality
- **🛠️ CLI Tools**: Command-line interface for VPN management
- **📝 Type Safety**: Full type hints and mypy support

## 📦 Installation

```bash
pip install pia-ctl-sdk
```

### Development Installation

```bash
# Clone the repository
git clone https://github.com/pr1m8/pia-ctl.git
cd pia-ctl

# Install with PDM
pdm install -G docs -G dev

# Or install with pip
pip install -e ".[dev,docs]"
```

## 🚀 Quick Start

### Basic Python Usage

```python
from pypia_ctl import init_settings, connect_vpn, get_status

# Initialize with environment settings
settings = init_settings(create_env=True)

# Connect to VPN with preferred region
result = connect_vpn(region="us-east")
print(f"Connected: {result.success}")

# Check VPN status
status = get_status()
print(f"VPN Status: {status.connected}")
print(f"Current Region: {status.region}")
print(f"IP Address: {status.ip_address}")
```

### Advanced Python Examples

```python
from pypia_ctl import PiaSettings, connect_with_strategy, monitor_connection
import asyncio

# Custom settings
settings = PiaSettings(
    protocol="wireguard",
    default_region="auto",
    preferred_regions=["us-east", "us-west", "europe"],
    randomize_region=True
)

# Connect with fallback strategy
result = connect_with_strategy(
    preferred=["us-east", "us-west"],
    fallback="random",
    timeout=30
)

# Async monitoring
async def monitor_vpn():
    async for status in monitor_connection():
        print(f"Status: {status.connected} - Region: {status.region}")
        if not status.connected:
            print("VPN disconnected, attempting reconnection...")
            connect_vpn()

# Run monitoring
asyncio.run(monitor_vpn())
```

### Proxy Integration Examples

```python
from pypia_ctl import PiaSettings
from pypia_ctl.adapters import PlaywrightAdapter, HttpxAdapter
import httpx
from playwright.async_api import async_playwright

# Configure proxy settings
settings = PiaSettings(
    proxy={
        "kind": "socks5",
        "host": "127.0.0.1",
        "port": 1080,
        "username": "user",
        "password": "pass"
    }
)

# Use with httpx
async with HttpxAdapter(settings) as client:
    response = await client.get("https://httpbin.org/ip")
    print(f"IP: {response.json()['origin']}")

# Use with Playwright
async with async_playwright() as p:
    browser = await p.chromium.launch()
    page = await browser.new_page()

    # Configure proxy
    await page.context.set_extra_http_headers({
        "Proxy-Authorization": "Basic dXNlcjpwYXNz"
    })

    await page.goto("https://httpbin.org/ip")
    content = await page.content()
    print("Page loaded with proxy")
```

### CLI Usage

```bash
# Initialize environment configuration
pypia env-init

# Connect to VPN with specific region
pypia connect --region us-east

# Connect with fallback strategy
pypia connect --preferred us-east,us-west --fallback random

# Check detailed status
pypia status --verbose

# Monitor connection in real-time
pypia monitor

# Disconnect
pypia disconnect

# List available regions
pypia regions

# Print environment configuration
pypia env-print
```

### Environment Configuration

Create a `.env` file with your preferences:

```bash
# Copy the example file
cp .env.example .env

# Edit with your settings
PIA_PROTOCOL=wireguard
PIA_DEFAULT_REGION=auto
PIA_RANDOMIZE_REGION=true
PIA_PREFERRED_REGIONS=["us-east", "us-west", "europe"]
```

## 📖 API Reference

### Core Functions

```python
from pypia_ctl import (
    init_settings,           # Initialize settings from env/.env
    connect_vpn,            # Connect to VPN
    disconnect_vpn,         # Disconnect VPN
    get_status,             # Get current VPN status
    connect_with_strategy,  # Connect with fallback strategy
    monitor_connection,     # Async connection monitoring
    ensure_env_file,        # Create/merge .env file
    generate_env_text,      # Generate .env content
)

# Settings and Configuration
from pypia_ctl import PiaSettings, EnvStatus

# Adapters for proxy integration
from pypia_ctl.adapters import PlaywrightAdapter, HttpxAdapter, SeleniumAdapter

# Exceptions
from pypia_ctl.exceptions import PiaError, ConnectionError, TimeoutError
```

### Settings Configuration

```python
from pypia_ctl import PiaSettings

# Full configuration example
settings = PiaSettings(
    # VPN Protocol
    protocol="wireguard",  # or "openvpn"

    # Region Settings
    default_region="auto",
    randomize_region=True,
    preferred_regions=["us-east", "us-west", "europe"],

    # Region Filtering
    region_filters={
        "include_streaming": False,
        "include_countries": ["US", "CA", "GB"],
        "exclude_countries": ["CN", "RU"]
    },

    # Proxy Configuration
    proxy={
        "kind": "socks5",
        "host": "127.0.0.1",
        "port": 1080,
        "username": "user",
        "password": "pass"
    },

    # Plugin Configuration
    plugins=["custom_plugin", "monitoring_plugin"]
)
```

## 🎯 Use Cases

### 1. Web Scraping with VPN

```python
from pypia_ctl import connect_vpn, HttpxAdapter
import httpx

# Connect to VPN
connect_vpn(region="us-east")

# Use with httpx for web scraping
async with HttpxAdapter() as client:
    response = await client.get("https://example.com")
    print(f"Scraped content: {response.text[:100]}...")
```

### 2. Automated Testing with Playwright

```python
from pypia_ctl import connect_vpn
from playwright.async_api import async_playwright

# Connect to VPN before testing
connect_vpn(region="europe")

async def test_with_vpn():
    async with async_playwright() as p:
        browser = await p.chromium.launch()
        page = await browser.new_page()

        # Test from different geographic location
        await page.goto("https://httpbin.org/ip")
        ip_info = await page.text_content("body")
        print(f"Testing from IP: {ip_info}")

        await browser.close()

# Run test
import asyncio
asyncio.run(test_with_vpn())
```

### 3. CI/CD Pipeline Integration

```yaml
# .github/workflows/test-with-vpn.yml
name: Test with VPN
on: [push, pull_request]

jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.13"

      - name: Install dependencies
        run: pip install pia-ctl-sdk

      - name: Connect to VPN and test
        run: |
          pypia connect --region us-east
          python -m pytest tests/
          pypia disconnect
```

### 4. Monitoring and Alerting

```python
import asyncio
from pypia_ctl import monitor_connection, connect_vpn
import logging

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

async def vpn_monitor():
    """Monitor VPN connection and auto-reconnect if needed."""
    async for status in monitor_connection():
        if not status.connected:
            logger.warning("VPN disconnected! Attempting reconnection...")
            try:
                connect_vpn()
                logger.info("VPN reconnected successfully")
            except Exception as e:
                logger.error(f"Failed to reconnect VPN: {e}")
        else:
            logger.info(f"VPN connected: {status.region} ({status.ip_address})")

# Run monitoring
asyncio.run(vpn_monitor())
```

## 🔧 Troubleshooting

### Common Issues

#### 1. VPN Connection Fails

```python
from pypia_ctl import connect_vpn, get_status
from pypia_ctl.exceptions import ConnectionError

try:
    result = connect_vpn(region="us-east")
    if not result.success:
        print(f"Connection failed: {result.error}")

        # Try alternative region
        result = connect_vpn(region="us-west")

except ConnectionError as e:
    print(f"Connection error: {e}")

    # Check if piactl is installed
    status = get_status()
    if not status.piactl_available:
        print("piactl not found. Please install PIA client.")
```

#### 2. Environment Configuration Issues

```python
from pypia_ctl import ensure_env_file, generate_env_text

# Create .env file with defaults
ensure_env_file(".env")

# Check generated configuration
env_content = generate_env_text()
print("Generated .env content:")
print(env_content)
```

#### 3. Proxy Configuration Problems

```python
from pypia_ctl import PiaSettings, HttpxAdapter

# Test proxy configuration
settings = PiaSettings(
    proxy={
        "kind": "socks5",
        "host": "127.0.0.1",
        "port": 1080
    }
)

try:
    async with HttpxAdapter(settings) as client:
        response = await client.get("https://httpbin.org/ip")
        print(f"Proxy working: {response.json()}")
except Exception as e:
    print(f"Proxy error: {e}")
```

## 📚 Documentation

### Local Development

```bash
# Serve documentation locally
pdm run docs

# Or with mkdocs directly
mkdocs serve
```

### Online Documentation

- **GitHub Pages**: [https://pr1m8.github.io/pia-ctl/](https://pr1m8.github.io/pia-ctl/)
- **API Reference**: Available in the docs
- **Examples**: See the `examples/` directory in the repository

## 🛠️ Development

### Setup Development Environment

```bash
# Clone and setup
git clone https://github.com/pr1m8/pia-ctl.git
cd pia-ctl

# Install development dependencies
pdm install -G dev -G docs -G test

# Run tests
pdm run test

# Run linting
pdm run lint

# Run type checking
pdm run typecheck
```

### Building Documentation

```bash
# MkDocs (recommended)
pdm run docs

# Sphinx (alternative)
pip install sphinx furo myst-parser
(cd sphinx-docs && make html)
```

## 🤝 Contributing

We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.

1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Add tests
5. Submit a pull request

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## 👨‍💻 Author

**William R. Astley** ([@pr1m8](https://github.com/pr1m8))

- GitHub: [https://github.com/pr1m8](https://github.com/pr1m8)
- Email: william.astley@algebraicwealth.com

## 🔗 Links

- **Repository**: [https://github.com/pr1m8/pia-ctl](https://github.com/pr1m8/pia-ctl)
- **PyPI Package**: [https://pypi.org/project/pia-ctl-sdk/](https://pypi.org/project/pia-ctl-sdk/)
- **Issues**: [https://github.com/pr1m8/pia-ctl/issues](https://github.com/pr1m8/pia-ctl/issues)
- **Documentation**: [https://pr1m8.github.io/pia-ctl/](https://pr1m8.github.io/pia-ctl/)

## ⭐ Support

If you find this project helpful, please consider giving it a star on GitHub!

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pia-ctl-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "==3.13.*",
    "maintainer_email": null,
    "keywords": "pia, vpn, piactl, proxy, playwright, selenium, httpx, pydantic",
    "author": null,
    "author_email": "0rac130fD31phi <william.astley@algebraicwealth.com>",
    "download_url": "https://files.pythonhosted.org/packages/87/de/511e80f8d835f65093c9fdfdbafbda03f8baae057198c3ae94d51dd09109/pia_ctl_sdk-0.1.3.tar.gz",
    "platform": null,
    "description": "# pia-ctl-sdk\n\n[![PyPI - Version](https://img.shields.io/pypi/v/pia-ctl-sdk.svg)](https://pypi.org/project/pia-ctl-sdk/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/pia-ctl-sdk.svg)](https://pypi.org/project/pia-ctl-sdk/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)\n[![Python - Version](https://img.shields.io/badge/python-3.13-blue.svg)](https://www.python.org/downloads/)\n[![CI - Release](https://github.com/pr1m8/pia-ctl/actions/workflows/release.yml/badge.svg)](https://github.com/pr1m8/pia-ctl/actions/workflows/release.yml)\n[![Code Style - Ruff](https://img.shields.io/badge/code%20style-ruff-000000.svg)](https://github.com/astral-sh/ruff)\n[![Type Checking - mypy](https://img.shields.io/badge/types-mypy-2A6DB2.svg)](http://mypy-lang.org/)\n[![Docs - GitHub Pages](https://img.shields.io/badge/docs-mkdocs--material-blue)](https://pr1m8.github.io/pia-ctl/)\n\nA **typed Python SDK** for the Private Internet Access (PIA) VPN CLI (`piactl`) with comprehensive environment management, proxy adapters, and automation capabilities.\n\n## \ud83d\ude80 Features\n\n- **\ud83d\udd12 VPN Management**: Connect, disconnect, and monitor PIA VPN connections\n- **\u2699\ufe0f Environment Configuration**: Pydantic v2 settings with `.env` file support\n- **\ud83c\udf10 Proxy Adapters**: Built-in support for Playwright, httpx, and Selenium\n- **\ud83d\udcca Status Monitoring**: Real-time VPN status and connection monitoring\n- **\ud83c\udfaf Smart Connection**: Strategy-based connection (preferred \u2192 random \u2192 default regions)\n- **\ud83d\udd0c Plugin System**: Extensible plugin architecture for custom functionality\n- **\ud83d\udee0\ufe0f CLI Tools**: Command-line interface for VPN management\n- **\ud83d\udcdd Type Safety**: Full type hints and mypy support\n\n## \ud83d\udce6 Installation\n\n```bash\npip install pia-ctl-sdk\n```\n\n### Development Installation\n\n```bash\n# Clone the repository\ngit clone https://github.com/pr1m8/pia-ctl.git\ncd pia-ctl\n\n# Install with PDM\npdm install -G docs -G dev\n\n# Or install with pip\npip install -e \".[dev,docs]\"\n```\n\n## \ud83d\ude80 Quick Start\n\n### Basic Python Usage\n\n```python\nfrom pypia_ctl import init_settings, connect_vpn, get_status\n\n# Initialize with environment settings\nsettings = init_settings(create_env=True)\n\n# Connect to VPN with preferred region\nresult = connect_vpn(region=\"us-east\")\nprint(f\"Connected: {result.success}\")\n\n# Check VPN status\nstatus = get_status()\nprint(f\"VPN Status: {status.connected}\")\nprint(f\"Current Region: {status.region}\")\nprint(f\"IP Address: {status.ip_address}\")\n```\n\n### Advanced Python Examples\n\n```python\nfrom pypia_ctl import PiaSettings, connect_with_strategy, monitor_connection\nimport asyncio\n\n# Custom settings\nsettings = PiaSettings(\n    protocol=\"wireguard\",\n    default_region=\"auto\",\n    preferred_regions=[\"us-east\", \"us-west\", \"europe\"],\n    randomize_region=True\n)\n\n# Connect with fallback strategy\nresult = connect_with_strategy(\n    preferred=[\"us-east\", \"us-west\"],\n    fallback=\"random\",\n    timeout=30\n)\n\n# Async monitoring\nasync def monitor_vpn():\n    async for status in monitor_connection():\n        print(f\"Status: {status.connected} - Region: {status.region}\")\n        if not status.connected:\n            print(\"VPN disconnected, attempting reconnection...\")\n            connect_vpn()\n\n# Run monitoring\nasyncio.run(monitor_vpn())\n```\n\n### Proxy Integration Examples\n\n```python\nfrom pypia_ctl import PiaSettings\nfrom pypia_ctl.adapters import PlaywrightAdapter, HttpxAdapter\nimport httpx\nfrom playwright.async_api import async_playwright\n\n# Configure proxy settings\nsettings = PiaSettings(\n    proxy={\n        \"kind\": \"socks5\",\n        \"host\": \"127.0.0.1\",\n        \"port\": 1080,\n        \"username\": \"user\",\n        \"password\": \"pass\"\n    }\n)\n\n# Use with httpx\nasync with HttpxAdapter(settings) as client:\n    response = await client.get(\"https://httpbin.org/ip\")\n    print(f\"IP: {response.json()['origin']}\")\n\n# Use with Playwright\nasync with async_playwright() as p:\n    browser = await p.chromium.launch()\n    page = await browser.new_page()\n\n    # Configure proxy\n    await page.context.set_extra_http_headers({\n        \"Proxy-Authorization\": \"Basic dXNlcjpwYXNz\"\n    })\n\n    await page.goto(\"https://httpbin.org/ip\")\n    content = await page.content()\n    print(\"Page loaded with proxy\")\n```\n\n### CLI Usage\n\n```bash\n# Initialize environment configuration\npypia env-init\n\n# Connect to VPN with specific region\npypia connect --region us-east\n\n# Connect with fallback strategy\npypia connect --preferred us-east,us-west --fallback random\n\n# Check detailed status\npypia status --verbose\n\n# Monitor connection in real-time\npypia monitor\n\n# Disconnect\npypia disconnect\n\n# List available regions\npypia regions\n\n# Print environment configuration\npypia env-print\n```\n\n### Environment Configuration\n\nCreate a `.env` file with your preferences:\n\n```bash\n# Copy the example file\ncp .env.example .env\n\n# Edit with your settings\nPIA_PROTOCOL=wireguard\nPIA_DEFAULT_REGION=auto\nPIA_RANDOMIZE_REGION=true\nPIA_PREFERRED_REGIONS=[\"us-east\", \"us-west\", \"europe\"]\n```\n\n## \ud83d\udcd6 API Reference\n\n### Core Functions\n\n```python\nfrom pypia_ctl import (\n    init_settings,           # Initialize settings from env/.env\n    connect_vpn,            # Connect to VPN\n    disconnect_vpn,         # Disconnect VPN\n    get_status,             # Get current VPN status\n    connect_with_strategy,  # Connect with fallback strategy\n    monitor_connection,     # Async connection monitoring\n    ensure_env_file,        # Create/merge .env file\n    generate_env_text,      # Generate .env content\n)\n\n# Settings and Configuration\nfrom pypia_ctl import PiaSettings, EnvStatus\n\n# Adapters for proxy integration\nfrom pypia_ctl.adapters import PlaywrightAdapter, HttpxAdapter, SeleniumAdapter\n\n# Exceptions\nfrom pypia_ctl.exceptions import PiaError, ConnectionError, TimeoutError\n```\n\n### Settings Configuration\n\n```python\nfrom pypia_ctl import PiaSettings\n\n# Full configuration example\nsettings = PiaSettings(\n    # VPN Protocol\n    protocol=\"wireguard\",  # or \"openvpn\"\n\n    # Region Settings\n    default_region=\"auto\",\n    randomize_region=True,\n    preferred_regions=[\"us-east\", \"us-west\", \"europe\"],\n\n    # Region Filtering\n    region_filters={\n        \"include_streaming\": False,\n        \"include_countries\": [\"US\", \"CA\", \"GB\"],\n        \"exclude_countries\": [\"CN\", \"RU\"]\n    },\n\n    # Proxy Configuration\n    proxy={\n        \"kind\": \"socks5\",\n        \"host\": \"127.0.0.1\",\n        \"port\": 1080,\n        \"username\": \"user\",\n        \"password\": \"pass\"\n    },\n\n    # Plugin Configuration\n    plugins=[\"custom_plugin\", \"monitoring_plugin\"]\n)\n```\n\n## \ud83c\udfaf Use Cases\n\n### 1. Web Scraping with VPN\n\n```python\nfrom pypia_ctl import connect_vpn, HttpxAdapter\nimport httpx\n\n# Connect to VPN\nconnect_vpn(region=\"us-east\")\n\n# Use with httpx for web scraping\nasync with HttpxAdapter() as client:\n    response = await client.get(\"https://example.com\")\n    print(f\"Scraped content: {response.text[:100]}...\")\n```\n\n### 2. Automated Testing with Playwright\n\n```python\nfrom pypia_ctl import connect_vpn\nfrom playwright.async_api import async_playwright\n\n# Connect to VPN before testing\nconnect_vpn(region=\"europe\")\n\nasync def test_with_vpn():\n    async with async_playwright() as p:\n        browser = await p.chromium.launch()\n        page = await browser.new_page()\n\n        # Test from different geographic location\n        await page.goto(\"https://httpbin.org/ip\")\n        ip_info = await page.text_content(\"body\")\n        print(f\"Testing from IP: {ip_info}\")\n\n        await browser.close()\n\n# Run test\nimport asyncio\nasyncio.run(test_with_vpn())\n```\n\n### 3. CI/CD Pipeline Integration\n\n```yaml\n# .github/workflows/test-with-vpn.yml\nname: Test with VPN\non: [push, pull_request]\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: actions/setup-python@v5\n        with:\n          python-version: \"3.13\"\n\n      - name: Install dependencies\n        run: pip install pia-ctl-sdk\n\n      - name: Connect to VPN and test\n        run: |\n          pypia connect --region us-east\n          python -m pytest tests/\n          pypia disconnect\n```\n\n### 4. Monitoring and Alerting\n\n```python\nimport asyncio\nfrom pypia_ctl import monitor_connection, connect_vpn\nimport logging\n\nlogging.basicConfig(level=logging.INFO)\nlogger = logging.getLogger(__name__)\n\nasync def vpn_monitor():\n    \"\"\"Monitor VPN connection and auto-reconnect if needed.\"\"\"\n    async for status in monitor_connection():\n        if not status.connected:\n            logger.warning(\"VPN disconnected! Attempting reconnection...\")\n            try:\n                connect_vpn()\n                logger.info(\"VPN reconnected successfully\")\n            except Exception as e:\n                logger.error(f\"Failed to reconnect VPN: {e}\")\n        else:\n            logger.info(f\"VPN connected: {status.region} ({status.ip_address})\")\n\n# Run monitoring\nasyncio.run(vpn_monitor())\n```\n\n## \ud83d\udd27 Troubleshooting\n\n### Common Issues\n\n#### 1. VPN Connection Fails\n\n```python\nfrom pypia_ctl import connect_vpn, get_status\nfrom pypia_ctl.exceptions import ConnectionError\n\ntry:\n    result = connect_vpn(region=\"us-east\")\n    if not result.success:\n        print(f\"Connection failed: {result.error}\")\n\n        # Try alternative region\n        result = connect_vpn(region=\"us-west\")\n\nexcept ConnectionError as e:\n    print(f\"Connection error: {e}\")\n\n    # Check if piactl is installed\n    status = get_status()\n    if not status.piactl_available:\n        print(\"piactl not found. Please install PIA client.\")\n```\n\n#### 2. Environment Configuration Issues\n\n```python\nfrom pypia_ctl import ensure_env_file, generate_env_text\n\n# Create .env file with defaults\nensure_env_file(\".env\")\n\n# Check generated configuration\nenv_content = generate_env_text()\nprint(\"Generated .env content:\")\nprint(env_content)\n```\n\n#### 3. Proxy Configuration Problems\n\n```python\nfrom pypia_ctl import PiaSettings, HttpxAdapter\n\n# Test proxy configuration\nsettings = PiaSettings(\n    proxy={\n        \"kind\": \"socks5\",\n        \"host\": \"127.0.0.1\",\n        \"port\": 1080\n    }\n)\n\ntry:\n    async with HttpxAdapter(settings) as client:\n        response = await client.get(\"https://httpbin.org/ip\")\n        print(f\"Proxy working: {response.json()}\")\nexcept Exception as e:\n    print(f\"Proxy error: {e}\")\n```\n\n## \ud83d\udcda Documentation\n\n### Local Development\n\n```bash\n# Serve documentation locally\npdm run docs\n\n# Or with mkdocs directly\nmkdocs serve\n```\n\n### Online Documentation\n\n- **GitHub Pages**: [https://pr1m8.github.io/pia-ctl/](https://pr1m8.github.io/pia-ctl/)\n- **API Reference**: Available in the docs\n- **Examples**: See the `examples/` directory in the repository\n\n## \ud83d\udee0\ufe0f Development\n\n### Setup Development Environment\n\n```bash\n# Clone and setup\ngit clone https://github.com/pr1m8/pia-ctl.git\ncd pia-ctl\n\n# Install development dependencies\npdm install -G dev -G docs -G test\n\n# Run tests\npdm run test\n\n# Run linting\npdm run lint\n\n# Run type checking\npdm run typecheck\n```\n\n### Building Documentation\n\n```bash\n# MkDocs (recommended)\npdm run docs\n\n# Sphinx (alternative)\npip install sphinx furo myst-parser\n(cd sphinx-docs && make html)\n```\n\n## \ud83e\udd1d Contributing\n\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\n\n1. Fork the repository\n2. Create a feature branch\n3. Make your changes\n4. Add tests\n5. Submit a pull request\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## \ud83d\udc68\u200d\ud83d\udcbb Author\n\n**William R. Astley** ([@pr1m8](https://github.com/pr1m8))\n\n- GitHub: [https://github.com/pr1m8](https://github.com/pr1m8)\n- Email: william.astley@algebraicwealth.com\n\n## \ud83d\udd17 Links\n\n- **Repository**: [https://github.com/pr1m8/pia-ctl](https://github.com/pr1m8/pia-ctl)\n- **PyPI Package**: [https://pypi.org/project/pia-ctl-sdk/](https://pypi.org/project/pia-ctl-sdk/)\n- **Issues**: [https://github.com/pr1m8/pia-ctl/issues](https://github.com/pr1m8/pia-ctl/issues)\n- **Documentation**: [https://pr1m8.github.io/pia-ctl/](https://pr1m8.github.io/pia-ctl/)\n\n## \u2b50 Support\n\nIf you find this project helpful, please consider giving it a star on GitHub!\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Typed mini-SDK for the PIA `piactl` CLI with env settings, strategy connect, async monitor, and proxy adapters.",
    "version": "0.1.3",
    "project_urls": {
        "Documentation": "https://pr1m8.github.io/pia-ctl/",
        "Homepage": "https://github.com/pr1m8/pia-ctl",
        "Issues": "https://github.com/pr1m8/pia-ctl/issues"
    },
    "split_keywords": [
        "pia",
        " vpn",
        " piactl",
        " proxy",
        " playwright",
        " selenium",
        " httpx",
        " pydantic"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "8bdf7ae496a4819538edc795cf1f54f38387346fdb704b0d4bc1118fe3eb76e1",
                "md5": "13bb6c97eac091be39eea6775942196d",
                "sha256": "a7cf974a33a5feb72629f01ca94ae562b9b05a7a8f037605511f913f611fe639"
            },
            "downloads": -1,
            "filename": "pia_ctl_sdk-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "13bb6c97eac091be39eea6775942196d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "==3.13.*",
            "size": 24951,
            "upload_time": "2025-10-10T07:44:10",
            "upload_time_iso_8601": "2025-10-10T07:44:10.273858Z",
            "url": "https://files.pythonhosted.org/packages/8b/df/7ae496a4819538edc795cf1f54f38387346fdb704b0d4bc1118fe3eb76e1/pia_ctl_sdk-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "87de511e80f8d835f65093c9fdfdbafbda03f8baae057198c3ae94d51dd09109",
                "md5": "217c69a5b6efadd14425dbaece814ace",
                "sha256": "a35da8a59facb19f51cdc879bb7a7532f121858d6906b4065fa3ea1ca595ab76"
            },
            "downloads": -1,
            "filename": "pia_ctl_sdk-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "217c69a5b6efadd14425dbaece814ace",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "==3.13.*",
            "size": 27840,
            "upload_time": "2025-10-10T07:44:11",
            "upload_time_iso_8601": "2025-10-10T07:44:11.692572Z",
            "url": "https://files.pythonhosted.org/packages/87/de/511e80f8d835f65093c9fdfdbafbda03f8baae057198c3ae94d51dd09109/pia_ctl_sdk-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-10 07:44:11",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pr1m8",
    "github_project": "pia-ctl",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pia-ctl-sdk"
}
        
Elapsed time: 0.47769s