Skip to main content

GenePlus Python Client - A simple HTTP client for GenePlus API

Project description

GenePlus Tools Test

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

Installation

pip install geneplus-tools-test

Quick Start

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

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

2. Environment Variable

export GENEPLUS_TOKEN="your-token-here"
client = GenePlusClient()  # Will use GENEPLUS_TOKEN

3. Config File

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

{
  "gp-tools-token": "your-token-here"
}
client = GenePlusClient()  # Will read from config file

CLI Usage

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

Test connectivity

gp-tool ping

Get user information

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

Help

gp-tool --help
gp-tool get-info --help

API Reference

GenePlusClient

__init__(token=None, base_url=None)

Initialize the client.

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

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

Build

python -m build

Publish to PyPI

twine upload dist/*

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

geneplus_tools_test-0.1.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

geneplus_tools_test-0.1.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file geneplus_tools_test-0.1.0.tar.gz.

File metadata

  • Download URL: geneplus_tools_test-0.1.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for geneplus_tools_test-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bceac35f02c6df095a93a94c3e0042aedf2aa0890be61d0d291de06e9baac57f
MD5 3710cfb01dc5a66d014408a8580fc538
BLAKE2b-256 7bc6e9216235c7b6652c56ff934f192f686eb18a778b0253ef6611083c1670df

See more details on using hashes here.

File details

Details for the file geneplus_tools_test-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for geneplus_tools_test-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18774f6548fc76d904868d4aa0b76cc7d11c1998b1a7f790ccf4cf68cb70e505
MD5 418f23e76dbc60a00f7a089e2aca91ab
BLAKE2b-256 c77a03070d3c636b870f6c381a8583140ef99731c5ec1fb120f034da9de22523

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page