Skip to main content

可用于调用 BGE 开放平台的相关接口。

Project description

BGE 开放平台 SDK - Python 版

GitHub forks GitHub forks GitHub forks

GitHub release (latest by date) GitHub top language GitHub code size in bytes GitHub commit activity PyPI - Downloads

    ____  ____________   ______  __________  ______  _   __   _____ ____  __ __
   / __ )/ ____/ ____/  / __ \ \/ /_  __/ / / / __ \/ | / /  / ___// __ \/ //_/
  / __  / / __/ __/    / /_/ /\  / / / / /_/ / / / /  |/ /   \__ \/ / / / ,<   
 / /_/ / /_/ / /___   / ____/ / / / / / __  / /_/ / /|  /   ___/ / /_/ / /| |  
/_____/\____/_____/  /_/     /_/ /_/ /_/ /_/\____/_/ |_/   /____/_____/_/ |_| 

BGE 开放平台 是一个跨越多级数据的(多)组学数据平台,开发者在获得用户授权后,将可以通过开放平台提供的 API 访问关联用户的(多)组学数据,甚至写入数据。

基于开放平台 API,开发者可避免重复开发采样、提取、测序和生信分析等繁复的流程,直接使用清洁的结构化数据。

开发者可以通过开放平台提供的 API 创建极具创意性的(多)组学应用,如:

  • 包含药物代谢或药物服用建议的应用
  • 包含体检数据和营养代谢基因的餐饮应用
  • 包含肠道菌群数据和痛风相关基因的痛风管理应用
  • 基于祖源成分的社交网络应用,等等

BGE 开放平台 API 基于 OAuth 2.0 开发,并使用 SSL/TLS 加密传输,确保用户数据正确无误地授权,并安全地传输到第三方应用,确保用户数据不会被未经授权的应用获得。

安装

推荐使用 pip 进行安装。

$ pip install -U bge-python-sdk

或者

$ make install

再或者

$ python setup.py install

SDK 文档

更加详细的 SDK 文档请查看 SDK Documents

快速开始

BGE 开放平台支持 OAuth2 的两种模式,分别是用户授权模式、客户端模式。

详情请参考开放平台文档 https://api.bge.genomics.cn/doc

ENDPOINTS

BGE 开放平台提供了如下可用的 endpoint

endpoint 解释
https://api.bge.genomics.cn 线上环境 主域名地址
https://api.bge.omgut.com 线上环境 副域名地址,主域名地址不可用时可替换此域名地址

授权码模式

from bgesdk import OAuth2, API

code = '???????'  # 用户确认授权后平台返回的授权码
client_id = 'demo'
client_secret = 'demo'
redirect_uri = 'http://test.cn'
oauth2 = OAuth2(
    client_id, client_secret,
    endpoint='https://api.bge.genomics.cn', max_retries=3, timeout=16,
    verbose=False)
token = oauth2.exchange_authorization_code(code, redirect_uri)

api = oauth2.get_api(token.access_token)
print(api.get_user())

api = API(token.access_token)
print(api.get_user())

客户端模式

from bgesdk import OAuth2, API

client_id = 'demo'
client_secret = 'demo'
oauth2 = OAuth2(
    client_id, client_secret,
    endpoint='https://api.bge.genomics.cn', max_retries=3, timeout=16,
    verbose=False)
token = oauth2.get_credentials_token()

api = oauth2.get_api(token.access_token)
print(api.get_variants('E-B1243433', 'rs333'))

api = API(token.access_token)
print(api.get_variants('E-B1243433', 'rs333'))

Contributors

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

bge-python-sdk-0.2.tar.gz (40.4 kB view details)

Uploaded Source

Built Distributions

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

bge_python_sdk-0.2-py3.8.egg (146.7 kB view details)

Uploaded Egg

bge_python_sdk-0.2-py3-none-any.whl (62.6 kB view details)

Uploaded Python 3

File details

Details for the file bge-python-sdk-0.2.tar.gz.

File metadata

  • Download URL: bge-python-sdk-0.2.tar.gz
  • Upload date:
  • Size: 40.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.0b4

File hashes

Hashes for bge-python-sdk-0.2.tar.gz
Algorithm Hash digest
SHA256 6a2b16858e654c9fcb88e76959250ff4f9b4cb2a748ca9467e71833b885f624f
MD5 0d3cd71645f412c5a0db91fedc0f9dcd
BLAKE2b-256 a67400527b281191d7aeeac5d3ffc4c9593f44b6e7fd38ec7425e3851bf20036

See more details on using hashes here.

File details

Details for the file bge_python_sdk-0.2-py3.8.egg.

File metadata

  • Download URL: bge_python_sdk-0.2-py3.8.egg
  • Upload date:
  • Size: 146.7 kB
  • Tags: Egg
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.0b4

File hashes

Hashes for bge_python_sdk-0.2-py3.8.egg
Algorithm Hash digest
SHA256 4bf8f7a8684984d934adb9cd0f1255e0788c3469d3b039c01de1a7df1cd6afe1
MD5 2c5db6da2d88abf81f0c7fe6fb2590fb
BLAKE2b-256 637e6e5bebd196474954be0dcd64ae988a447809855cb6e35e10a9365e5883b5

See more details on using hashes here.

File details

Details for the file bge_python_sdk-0.2-py3-none-any.whl.

File metadata

  • Download URL: bge_python_sdk-0.2-py3-none-any.whl
  • Upload date:
  • Size: 62.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.0b4

File hashes

Hashes for bge_python_sdk-0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 693499c9b85392170a0ee1422f68fed1bf4b2974845581f8f073b6cd55e21b50
MD5 d72abcdd5e00117463321f7e77e52789
BLAKE2b-256 2bd426aa76961f811199a87ff99cedc1fa2aeba709acd8d4f326d3215adc3917

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