可用于调用 BGE 开放平台的相关接口。
Project description
BGE 开放平台 SDK - Python 版
____ ____________ ______ __________ ______ _ __ _____ ____ __ __ / __ )/ ____/ ____/ / __ \ \/ /_ __/ / / / __ \/ | / / / ___// __ \/ //_/ / __ / / __/ __/ / /_/ /\ / / / / /_/ / / / / |/ / \__ \/ / / / ,< / /_/ / /_/ / /___ / ____/ / / / / / __ / /_/ / /| / ___/ / /_/ / /| | /_____/\____/_____/ /_/ /_/ /_/ /_/ /_/\____/_/ |_/ /____/_____/_/ |_|
BGE 开放平台 是一个跨越多级数据的(多)组学数据平台,开发者在获得用户授权后,将可以通过开放平台提供的 API 访问关联用户的(多)组学数据,甚至写入数据。
基于开放平台 API,开发者可避免重复开发采样、提取、测序和生信分析等繁复的流程,直接使用清洁的结构化数据。
开发者可以通过开放平台提供的 API 创建极具创意性的(多)组学应用,如:
- 包含药物代谢或药物服用建议的应用
- 包含体检数据和营养代谢基因的餐饮应用
- 包含肠道菌群数据和痛风相关基因的痛风管理应用
- 基于祖源成分的社交网络应用,等等
BGE 开放平台 API 基于 OAuth 2.0 开发,并使用 SSL/TLS 加密传输,确保用户数据正确无误地授权,并安全地传输到第三方应用,确保用户数据不会被未经授权的应用获得。
安装
推荐使用 pip 进行安装。
$ pip install bge-python-sdk
或者
$ make install
再或者
$ python setup.py install
SDK 文档
更加详细的 SDK 文档请查看 SDK Documents。
快速开始
BGE 开放平台支持 OAuth2 的两种模式,分别是用户授权模式、客户端模式。
详情请参考开放平台文档 https://api.bge.genomics.cn/doc 。
授权码模式
from bgesdk import OAuth2
code = '???????' # 用户确认授权后平台返回的授权码
client_id = 'demo'
client_secret = 'demo'
redirect_uri = 'http://test.cn'
oauth2 = OAuth2(client_id, client_secret)
token = oauth2.exchange_authorization_code(code, redirect_uri)
api = oauth2.get_api(token.access_token)
print(api.get_user())
客户端模式
from bgesdk import OAuth2
client_id = 'demo'
client_secret = 'demo'
oauth2 = OAuth2(client_id, client_secret)
token = oauth2.get_credentials_token()
api = oauth2.get_api(token.access_token)
print(api.get_variants('E-B1243433', 'rs333'))
Contributors
- xiangji1204's github
- leafcoder(leafcoder@gmail.com)'s github
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
bge-python-sdk-0.1a2.tar.gz
(14.2 kB
view hashes)
Built Distribution
Close
Hashes for bge_python_sdk-0.1a2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60ff5065b790a07cd54b6a338076ca9ac9929a25a1408f1210baabc2394de973 |
|
MD5 | add1d9c794f4a032eded56db2c9c73ef |
|
BLAKE2b-256 | 055172e704cb6a2857cad05094504a7fc88577dfecdbd0c8b1127df64d0d10aa |