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.
token: Optional API tokenbase_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 namephone: User phone number (11 digits, starts with 1)
Returns user information string.
Raises:
ValueError: If phone number format is invalidGenePlusAuthError: If token is invalidGenePlusAPIError: If API returns other errorsGenePlusConnectionError: If network connection fails
Exceptions
GenePlusError: Base exceptionGenePlusConnectionError: Network connection errorGenePlusAuthError: Authentication error (invalid token)GenePlusAPIError: API errorGenePlusConfigError: 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec9adcb3bc52e19871eb4bff32e1d5e4f9159a81e6d22fdabb3de1fe1d96f000
|
|
| MD5 |
6a61ee03118c606a6d10500e2b10310b
|
|
| BLAKE2b-256 |
382894b885baf247af407b910240f690acb2e6ee1e5a258652fe56893b00eadd
|
File details
Details for the file geneplus_tools_test-0.1.1-py3-none-any.whl.
File metadata
- Download URL: geneplus_tools_test-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9da59d4defac8b9a14b8bcb286defe91b764197a7133deafd6d3d985e9addc63
|
|
| MD5 |
fc510c8a4d89542655a67785ae373437
|
|
| BLAKE2b-256 |
c21b4d0ade8b51877a5881200e2dd3596842d7bbe29729aa3b4ab84afec5e00b
|