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.1.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.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: geneplus_tools_test-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 ec9adcb3bc52e19871eb4bff32e1d5e4f9159a81e6d22fdabb3de1fe1d96f000
MD5 6a61ee03118c606a6d10500e2b10310b
BLAKE2b-256 382894b885baf247af407b910240f690acb2e6ee1e5a258652fe56893b00eadd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for geneplus_tools_test-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9da59d4defac8b9a14b8bcb286defe91b764197a7133deafd6d3d985e9addc63
MD5 fc510c8a4d89542655a67785ae373437
BLAKE2b-256 c21b4d0ade8b51877a5881200e2dd3596842d7bbe29729aa3b4ab84afec5e00b

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