Metadata-Version: 2.4
Name: geneplus-tools-test
Version: 0.1.0
Summary: GenePlus Python Client - A simple HTTP client for GenePlus API
Project-URL: Homepage, https://github.com/geneplus/geneplus-tools-test
Project-URL: Documentation, https://github.com/geneplus/geneplus-tools-test#readme
Project-URL: Repository, https://github.com/geneplus/geneplus-tools-test.git
Project-URL: Issues, https://github.com/geneplus/geneplus-tools-test/issues
Author: GenePlus Team
License: MIT
Keywords: api,client,geneplus,http
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Requires-Dist: requests>=2.25.0
Provides-Extra: dev
Requires-Dist: build; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: twine; extra == 'dev'
Description-Content-Type: text/markdown

# GenePlus Tools Test

GenePlus Python Client - A simple HTTP client for GenePlus API.

## Installation

```bash
pip install geneplus-tools-test
```

## Quick Start

```python
from geneplus_tools_test import GenePlusClient

# Create client (token will be loaded from config or environment variable)
client = GenePlusClient()

# Test connectivity
result = client.ping()
print(result)  # 'pong'

# Get user info
info = client.get_info("张三", "13512341234")
print(info)  # '张三 - 13512341234，喜欢探索新事物'
```

## Configuration

The client can be configured in three ways (in order of priority):

### 1. Direct Token

```python
client = GenePlusClient(token="your-token-here")
```

### 2. Environment Variable

```bash
export GENEPLUS_TOKEN="your-token-here"
```

```python
client = GenePlusClient()  # Will use GENEPLUS_TOKEN
```

### 3. Config File

Create `~/.config/geneplus/token.json`:

```json
{
  "gp-tools-token": "your-token-here"
}
```

```python
client = GenePlusClient()  # Will read from config file
```

## CLI Usage

After installation, you can use the `gp-tool` command:

### Test connectivity

```bash
gp-tool ping
```

### Get user information

```bash
gp-tool get-info --name "张三" --phone "13512341234"
```

### Help

```bash
gp-tool --help
gp-tool get-info --help
```

## API Reference

### GenePlusClient

#### `__init__(token=None, base_url=None)`

Initialize the client.

- `token`: Optional API token
- `base_url`: Optional base URL (default: http://jdh.test.geneplus.org.cn)

#### `ping() -> str`

Test network connectivity to the server.

Returns response text from the server.

Raises `GenePlusConnectionError` if connection fails.

#### `get_info(name: str, phone: str) -> str`

Get user information from the server.

- `name`: User name
- `phone`: User phone number (11 digits, starts with 1)

Returns user information string.

Raises:
- `ValueError`: If phone number format is invalid
- `GenePlusAuthError`: If token is invalid
- `GenePlusAPIError`: If API returns other errors
- `GenePlusConnectionError`: If network connection fails

## Exceptions

- `GenePlusError`: Base exception
- `GenePlusConnectionError`: Network connection error
- `GenePlusAuthError`: Authentication error (invalid token)
- `GenePlusAPIError`: API error
- `GenePlusConfigError`: Configuration error (missing token)

## Development

### Setup

```bash
git clone https://github.com/geneplus/geneplus-tools-test.git
cd geneplus-tools-test
pip install -e ".[dev]"
```

### Build

```bash
python -m build
```

### Publish to PyPI

```bash
twine upload dist/*
```

## License

MIT
