Metadata-Version: 2.4
Name: py_connect_test
Version: 2.2.0
Summary: A simple Python package for testing connectivity.
License: MIT
Keywords: python3
Author: Victor Bajada
Author-email: bajada.victor@gmail.com
Maintainer: Victor Bajada
Maintainer-email: bajada.victor@gmail.com
Requires-Python: >=3.14,<4.0
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Typing :: Typed
Requires-Dist: httpx (>=0.28.1,<0.29.0)
Requires-Dist: loguru (>=0.7.0,<0.8.0)
Requires-Dist: pydantic-settings (>=2.14.1,<3.0.0)
Requires-Dist: rich (>=14.0.0,<15.0.0)
Requires-Dist: typer (>=0.25.0,<0.26.0)
Project-URL: Changelog, https://github.com/Diapolo10/project-name/blob/main/CHANGELOG.md
Project-URL: Documentation, https://github.com/tech1ndex/py-connect-test/tree/main/docs
Project-URL: Homepage, https://pypi.org/project/py-connect-test/
Project-URL: Repository, https://github.com/tech1ndex/py-connect-test
Project-URL: Tracker, https://github.com/Diapolo10/project-name/issues
Description-Content-Type: text/markdown

# py-connect-test

A simple Python package to test HTTP connectivity to URLs and retrieve status codes. Built with Typer CLI framework and httpx.

## Prerequisites

- Python 3.14 or higher
- Poetry (for dependency management)

## Installation

### From Source

```bash
git clone https://github.com/tech1ndex/py-connect-test.git
cd py-connect-test
poetry install
```

## Usage

### Basic Usage

Test connectivity to the default URL (https://ifconfig.me):

```bash
poetry run py-connect-test test
```

Or directly:

```bash
python -m py_connect_test.main test
```

### Options

#### Bypass SSL Certificate Validation

```bash
poetry run py-connect-test test --insecure
# or
poetry run py-connect-test test -i
```

#### Send Alerts to Webhook

```bash
poetry run py-connect-test test --alerts
# or
poetry run py-connect-test test -a
```

#### Combined Options

```bash
poetry run py-connect-test test --insecure --alerts
```

### View Help

```bash
poetry run py-connect-test test --help
```

## Docker Usage

### Build Image

```bash
docker build -t py-connect-test:latest .
```

### Run Container

```bash
docker run -d \
  -e HTTP_URL=https://example.com \
  -e WEBHOOK_URL=http://prometheus.local \
  ghcr.io/tech1ndex/py-connect-test:latest
```

### Bypass SSL Validation

```bash
docker run -d \
  -e PY_CONNECT_TEST_URL=https://example.com \
  ghcr.io/tech1ndex/py-connect-test:latest \
  py-connect-test test --insecure
```

### Multi-Architecture Support

Available architectures:
- `amd64`
- `arm64`

Pull specific architecture:

```bash
docker pull ghcr.io/tech1ndex/py-connect-test:latest-amd64
docker pull ghcr.io/tech1ndex/py-connect-test:latest-arm64
```

## Environment Variables

| Variable              | Description | Default | Required |
|-----------------------|-------------|---------|----------|
| `PY_CONNECT_TEST_URL` | URL to test connectivity to | `https://ifconfig.me` | No |
| `WEBHOOK_URL`         | Webhook URL for alerts | `http://prometheus.local` | No |
| `PAYLOAD_FILE_PATH`   | Path to JSON payload file for webhooks | `/tmp/payload.json` | No |


## Project Structure

```
py-connect-test/
├── src/py_connect_test/
│   ├── main.py                 # CLI entry point
│   ├── settings.py             # Configuration management
│   ├── setup_logger.py         # Logger setup
│   ├── py.typed                # Type hints marker
│   └── services/
│       └── http.py             # HTTP service
├── tests/
│   ├── conftest.py            # Pytest fixtures
│   └── services/
│       └── test_http_service.py # HTTP service tests
├── pyproject.toml             # Project configuration
├── Dockerfile                 # Docker configuration
└── README.md
```

