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

安装

推荐使用 pip 进行安装

$ pip install bgesdk

或者
$ cd <BGE_PYTHON_SDK>/
$ make install

运行单元测试

$ pip install pytest
$ cd <BGE_PYTHON_SDK>/
$ make test

生成本地文档

$ pip install sphinx sphinx_rtd_theme
$ cd <BGE_PYTHON_SDK>/
$ make apidoc

快速开始

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

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.1a1.tar.gz (12.4 kB view hashes)

Uploaded Source

Built Distributions

bge_python_sdk-0.1a1-py3-none-any.whl (16.2 kB view hashes)

Uploaded Python 3

bge_python_sdk-0.1a1-py2-none-any.whl (16.1 kB view hashes)

Uploaded Python 2

Supported by

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