<div align="center">
# BGE 开放平台 SDK - Python 版
<p>
<!-- Place this tag where you want the button to render. -->
<a class="github-button" href="https://github.com/teambge/bge-python-sdk/subscription" data-color-scheme="no-preference: light; light: light; dark: dark;" data-show-count="true" aria-label="Watch teambge/bge-python-sdk on GitHub">
<img alt="GitHub forks" src="https://img.shields.io/github/watchers/teambge/bge-python-sdk?style=social">
</a>
<a class="github-button" href="https://github.com/teambge/bge-python-sdk" data-color-scheme="no-preference: light; light: light; dark: dark;" data-show-count="true" aria-label="Star teambge/bge-python-sdk on GitHub">
<img alt="GitHub forks" src="https://img.shields.io/github/stars/teambge/bge-python-sdk?style=social">
</a>
<a class="github-button" href="https://github.com/teambge/bge-python-sdk/fork" data-color-scheme="no-preference: light; light: light; dark: dark;" data-show-count="true" aria-label="Fork teambge/bge-python-sdk on GitHub">
<img alt="GitHub forks" src="https://img.shields.io/github/forks/teambge/bge-python-sdk?style=social">
</a>
</p>
<p>
<img src="https://img.shields.io/github/v/release/teambge/bge-python-sdk" data-origin="https://img.shields.io/github/v/release/teambge/bge-python-sdk" alt="GitHub release (latest by date)">
<img src="https://img.shields.io/github/languages/top/teambge/bge-python-sdk" data-origin="https://img.shields.io/github/languages/top/teambge/bge-python-sdk" alt="GitHub top language">
<img src="https://img.shields.io/github/languages/code-size/teambge/bge-python-sdk" data-origin="https://img.shields.io/github/languages/code-size/teambge/bge-python-sdk" alt="GitHub code size in bytes">
<img src="https://img.shields.io/github/commit-activity/w/teambge/bge-python-sdk" data-origin="https://img.shields.io/github/commit-activity/w/teambge/bge-python-sdk" alt="GitHub commit activity">
<img src="https://static.pepy.tech/personalized-badge/bge-python-sdk?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads" data-origin="https://static.pepy.tech/personalized-badge/bge-python-sdk?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads" alt="PyPI - Downloads">
</p>
<pre>
____ ____________ ______ __________ ______ _ __ _____ ____ __ __
/ __ )/ ____/ ____/ / __ \ \/ /_ __/ / / / __ \/ | / / / ___// __ \/ //_/
/ __ / / __/ __/ / /_/ /\ / / / / /_/ / / / / |/ / \__ \/ / / / ,<
/ /_/ / /_/ / /___ / ____/ / / / / / __ / /_/ / /| / ___/ / /_/ / /| |
/_____/\____/_____/ /_/ /_/ /_/ /_/ /_/\____/_/ |_/ /____/_____/_/ |_|
</pre>
</div>
BGE 开放平台 是一个跨越多级数据的(多)组学数据平台,开发者在获得用户授权后,将可以通过开放平台提供的 API 访问关联用户的(多)组学数据,甚至写入数据。
基于开放平台 API,开发者可避免重复开发采样、提取、测序和生信分析等繁复的流程,直接使用清洁的结构化数据。
开发者可以通过开放平台提供的 API 创建极具创意性的(多)组学应用,如:
* 包含药物代谢或药物服用建议的应用
* 包含体检数据和营养代谢基因的餐饮应用
* 包含肠道菌群数据和痛风相关基因的痛风管理应用
* 基于祖源成分的社交网络应用,等等
BGE 开放平台 API 基于 OAuth 2.0 开发,并使用 SSL/TLS 加密传输,确保用户数据正确无误地授权,并安全地传输到第三方应用,确保用户数据不会被未经授权的应用获得。
# 安装
推荐使用 pip 进行安装。
```shell
$ pip install -U bge-python-sdk
```
或者
```shell
$ make install
```
再或者
```shell
$ python setup.py install
```
# SDK 文档
更加详细的 SDK 文档请查看 [SDK Documents](https://api.bge.genomics.cn/doc/#/sdk/README)。
# 快速开始
BGE 开放平台支持 OAuth2 的两种模式,分别是用户授权模式、客户端模式。
详情请参考开放平台文档 [https://api.bge.genomics.cn/doc](https://api.bge.genomics.cn/doc) 。
## ENDPOINTS
BGE 开放平台提供了如下可用的 `endpoint`。
| endpoint | 解释 |
| --------------------------- | ----------------------------------------------------------- |
| https://api.bge.genomics.cn | **线上环境** 主域名地址 |
| https://api.bge.omgut.com | **线上环境** 副域名地址,主域名地址不可用时可替换此域名地址 |
## 授权码模式
```python
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())
```
## 客户端模式
```python
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
* xiangji1204's [github](https://github.com/xiangji1204)
* leafcoder(leafcoder@gmail.com)'s [github](https://github.com/leafcoder)
Raw data
{
"_id": null,
"home_page": "https://github.com/teambge/bge-python-sdk",
"name": "bge-python-sdk",
"maintainer": "leafcoder",
"docs_url": null,
"requires_python": ">=3.6.3",
"maintainer_email": "leafcoder@gmail.com",
"keywords": "bge-python-sdk bge bgesdk sdk",
"author": "leafcoder,xiangji1204",
"author_email": "leafcoder@gmail.com,xiangji1204@genomics.cn",
"download_url": "https://files.pythonhosted.org/packages/9f/94/36aba080518dc7604c34e623abb00a883fe516266aaf061558920785a2a0/bge-python-sdk-0.7.0.tar.gz",
"platform": null,
"description": "\n<div align=\"center\">\n\n# BGE \u5f00\u653e\u5e73\u53f0 SDK - Python \u7248\n\n\n<p>\n <!-- Place this tag where you want the button to render. -->\n <a class=\"github-button\" href=\"https://github.com/teambge/bge-python-sdk/subscription\" data-color-scheme=\"no-preference: light; light: light; dark: dark;\" data-show-count=\"true\" aria-label=\"Watch teambge/bge-python-sdk on GitHub\">\n <img alt=\"GitHub forks\" src=\"https://img.shields.io/github/watchers/teambge/bge-python-sdk?style=social\">\n </a>\n <a class=\"github-button\" href=\"https://github.com/teambge/bge-python-sdk\" data-color-scheme=\"no-preference: light; light: light; dark: dark;\" data-show-count=\"true\" aria-label=\"Star teambge/bge-python-sdk on GitHub\">\n <img alt=\"GitHub forks\" src=\"https://img.shields.io/github/stars/teambge/bge-python-sdk?style=social\">\n </a>\n <a class=\"github-button\" href=\"https://github.com/teambge/bge-python-sdk/fork\" data-color-scheme=\"no-preference: light; light: light; dark: dark;\" data-show-count=\"true\" aria-label=\"Fork teambge/bge-python-sdk on GitHub\">\n <img alt=\"GitHub forks\" src=\"https://img.shields.io/github/forks/teambge/bge-python-sdk?style=social\">\n </a>\n</p>\n\n<p>\n <img src=\"https://img.shields.io/github/v/release/teambge/bge-python-sdk\" data-origin=\"https://img.shields.io/github/v/release/teambge/bge-python-sdk\" alt=\"GitHub release (latest by date)\">\n <img src=\"https://img.shields.io/github/languages/top/teambge/bge-python-sdk\" data-origin=\"https://img.shields.io/github/languages/top/teambge/bge-python-sdk\" alt=\"GitHub top language\">\n <img src=\"https://img.shields.io/github/languages/code-size/teambge/bge-python-sdk\" data-origin=\"https://img.shields.io/github/languages/code-size/teambge/bge-python-sdk\" alt=\"GitHub code size in bytes\">\n <img src=\"https://img.shields.io/github/commit-activity/w/teambge/bge-python-sdk\" data-origin=\"https://img.shields.io/github/commit-activity/w/teambge/bge-python-sdk\" alt=\"GitHub commit activity\">\n <img src=\"https://static.pepy.tech/personalized-badge/bge-python-sdk?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads\" data-origin=\"https://static.pepy.tech/personalized-badge/bge-python-sdk?period=total&units=international_system&left_color=grey&right_color=blue&left_text=Downloads\" alt=\"PyPI - Downloads\">\n</p>\n\n<pre>\n ____ ____________ ______ __________ ______ _ __ _____ ____ __ __\n / __ )/ ____/ ____/ / __ \\ \\/ /_ __/ / / / __ \\/ | / / / ___// __ \\/ //_/\n / __ / / __/ __/ / /_/ /\\ / / / / /_/ / / / / |/ / \\__ \\/ / / / ,< \n / /_/ / /_/ / /___ / ____/ / / / / / __ / /_/ / /| / ___/ / /_/ / /| | \n/_____/\\____/_____/ /_/ /_/ /_/ /_/ /_/\\____/_/ |_/ /____/_____/_/ |_| \n</pre>\n\n</div>\n\nBGE \u5f00\u653e\u5e73\u53f0 \u662f\u4e00\u4e2a\u8de8\u8d8a\u591a\u7ea7\u6570\u636e\u7684\uff08\u591a\uff09\u7ec4\u5b66\u6570\u636e\u5e73\u53f0\uff0c\u5f00\u53d1\u8005\u5728\u83b7\u5f97\u7528\u6237\u6388\u6743\u540e\uff0c\u5c06\u53ef\u4ee5\u901a\u8fc7\u5f00\u653e\u5e73\u53f0\u63d0\u4f9b\u7684 API \u8bbf\u95ee\u5173\u8054\u7528\u6237\u7684\uff08\u591a\uff09\u7ec4\u5b66\u6570\u636e\uff0c\u751a\u81f3\u5199\u5165\u6570\u636e\u3002\n\n\u57fa\u4e8e\u5f00\u653e\u5e73\u53f0 API\uff0c\u5f00\u53d1\u8005\u53ef\u907f\u514d\u91cd\u590d\u5f00\u53d1\u91c7\u6837\u3001\u63d0\u53d6\u3001\u6d4b\u5e8f\u548c\u751f\u4fe1\u5206\u6790\u7b49\u7e41\u590d\u7684\u6d41\u7a0b\uff0c\u76f4\u63a5\u4f7f\u7528\u6e05\u6d01\u7684\u7ed3\u6784\u5316\u6570\u636e\u3002\n\n\u5f00\u53d1\u8005\u53ef\u4ee5\u901a\u8fc7\u5f00\u653e\u5e73\u53f0\u63d0\u4f9b\u7684 API \u521b\u5efa\u6781\u5177\u521b\u610f\u6027\u7684\uff08\u591a\uff09\u7ec4\u5b66\u5e94\u7528\uff0c\u5982\uff1a\n\n* \u5305\u542b\u836f\u7269\u4ee3\u8c22\u6216\u836f\u7269\u670d\u7528\u5efa\u8bae\u7684\u5e94\u7528\n* \u5305\u542b\u4f53\u68c0\u6570\u636e\u548c\u8425\u517b\u4ee3\u8c22\u57fa\u56e0\u7684\u9910\u996e\u5e94\u7528\n* \u5305\u542b\u80a0\u9053\u83cc\u7fa4\u6570\u636e\u548c\u75db\u98ce\u76f8\u5173\u57fa\u56e0\u7684\u75db\u98ce\u7ba1\u7406\u5e94\u7528\n* \u57fa\u4e8e\u7956\u6e90\u6210\u5206\u7684\u793e\u4ea4\u7f51\u7edc\u5e94\u7528\uff0c\u7b49\u7b49\n\nBGE \u5f00\u653e\u5e73\u53f0 API \u57fa\u4e8e OAuth 2.0 \u5f00\u53d1\uff0c\u5e76\u4f7f\u7528 SSL/TLS \u52a0\u5bc6\u4f20\u8f93\uff0c\u786e\u4fdd\u7528\u6237\u6570\u636e\u6b63\u786e\u65e0\u8bef\u5730\u6388\u6743\uff0c\u5e76\u5b89\u5168\u5730\u4f20\u8f93\u5230\u7b2c\u4e09\u65b9\u5e94\u7528\uff0c\u786e\u4fdd\u7528\u6237\u6570\u636e\u4e0d\u4f1a\u88ab\u672a\u7ecf\u6388\u6743\u7684\u5e94\u7528\u83b7\u5f97\u3002\n\n# \u5b89\u88c5\n\n\u63a8\u8350\u4f7f\u7528 pip \u8fdb\u884c\u5b89\u88c5\u3002\n\n```shell\n$ pip install -U bge-python-sdk\n```\n\n\u6216\u8005\n\n```shell\n$ make install\n```\n\n\u518d\u6216\u8005\n\n```shell\n$ python setup.py install\n```\n\n# SDK \u6587\u6863\n\n\u66f4\u52a0\u8be6\u7ec6\u7684 SDK \u6587\u6863\u8bf7\u67e5\u770b [SDK Documents](https://api.bge.genomics.cn/doc/#/sdk/README)\u3002\n\n# \u5feb\u901f\u5f00\u59cb\n\nBGE \u5f00\u653e\u5e73\u53f0\u652f\u6301 OAuth2 \u7684\u4e24\u79cd\u6a21\u5f0f\uff0c\u5206\u522b\u662f\u7528\u6237\u6388\u6743\u6a21\u5f0f\u3001\u5ba2\u6237\u7aef\u6a21\u5f0f\u3002\n\n\u8be6\u60c5\u8bf7\u53c2\u8003\u5f00\u653e\u5e73\u53f0\u6587\u6863 [https://api.bge.genomics.cn/doc](https://api.bge.genomics.cn/doc) \u3002\n\n## ENDPOINTS\n\nBGE \u5f00\u653e\u5e73\u53f0\u63d0\u4f9b\u4e86\u5982\u4e0b\u53ef\u7528\u7684 `endpoint`\u3002\n\n| endpoint | \u89e3\u91ca |\n| --------------------------- | ----------------------------------------------------------- |\n| https://api.bge.genomics.cn | **\u7ebf\u4e0a\u73af\u5883** \u4e3b\u57df\u540d\u5730\u5740 |\n| https://api.bge.omgut.com | **\u7ebf\u4e0a\u73af\u5883** \u526f\u57df\u540d\u5730\u5740\uff0c\u4e3b\u57df\u540d\u5730\u5740\u4e0d\u53ef\u7528\u65f6\u53ef\u66ff\u6362\u6b64\u57df\u540d\u5730\u5740 |\n\n## \u6388\u6743\u7801\u6a21\u5f0f\n\n```python\nfrom bgesdk import OAuth2, API\n\ncode = '???????' # \u7528\u6237\u786e\u8ba4\u6388\u6743\u540e\u5e73\u53f0\u8fd4\u56de\u7684\u6388\u6743\u7801\nclient_id = 'demo'\nclient_secret = 'demo'\nredirect_uri = 'http://test.cn'\noauth2 = OAuth2(\n client_id, client_secret,\n endpoint='https://api.bge.genomics.cn', max_retries=3, timeout=16,\n verbose=False)\ntoken = oauth2.exchange_authorization_code(code, redirect_uri)\n\napi = oauth2.get_api(token.access_token)\nprint(api.get_user())\n\napi = API(token.access_token)\nprint(api.get_user())\n```\n\n## \u5ba2\u6237\u7aef\u6a21\u5f0f\n\n```python\nfrom bgesdk import OAuth2, API\n\nclient_id = 'demo'\nclient_secret = 'demo'\noauth2 = OAuth2(\n client_id, client_secret,\n endpoint='https://api.bge.genomics.cn', max_retries=3, timeout=16,\n verbose=False)\ntoken = oauth2.get_credentials_token()\n\napi = oauth2.get_api(token.access_token)\nprint(api.get_variants('E-B1243433', 'rs333'))\n\napi = API(token.access_token)\nprint(api.get_variants('E-B1243433', 'rs333'))\n```\n\n# Contributors\n\n* xiangji1204's [github](https://github.com/xiangji1204)\n* leafcoder(leafcoder@gmail.com)'s [github](https://github.com/leafcoder)\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "\u53ef\u7528\u4e8e\u8c03\u7528 BGE \u5f00\u653e\u5e73\u53f0\u7684\u76f8\u5173\u63a5\u53e3\u3002",
"version": "0.7.0",
"project_urls": {
"Homepage": "https://github.com/teambge/bge-python-sdk"
},
"split_keywords": [
"bge-python-sdk",
"bge",
"bgesdk",
"sdk"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9bcaebe05f58fb03f025a7995588970e97e8e2aaa4cb63ceb19aae8ed3e40c1b",
"md5": "704d2911e14b849e9b14281674596d3d",
"sha256": "26bec50ae68599c27231fc6239146da192d7f3763b3f2ef018665f8f5cf67f91"
},
"downloads": -1,
"filename": "bge_python_sdk-0.7.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "704d2911e14b849e9b14281674596d3d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6.3",
"size": 81256,
"upload_time": "2024-11-22T08:30:18",
"upload_time_iso_8601": "2024-11-22T08:30:18.573309Z",
"url": "https://files.pythonhosted.org/packages/9b/ca/ebe05f58fb03f025a7995588970e97e8e2aaa4cb63ceb19aae8ed3e40c1b/bge_python_sdk-0.7.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9f9436aba080518dc7604c34e623abb00a883fe516266aaf061558920785a2a0",
"md5": "3f626fe0c8ee3a62c85b6c9e720c3b9d",
"sha256": "5f71f33971fa7c1fe58d81cc86bb1caa3a35aa05e42abbeb6496bc397551ce5e"
},
"downloads": -1,
"filename": "bge-python-sdk-0.7.0.tar.gz",
"has_sig": false,
"md5_digest": "3f626fe0c8ee3a62c85b6c9e720c3b9d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6.3",
"size": 53220,
"upload_time": "2024-11-22T08:30:21",
"upload_time_iso_8601": "2024-11-22T08:30:21.710193Z",
"url": "https://files.pythonhosted.org/packages/9f/94/36aba080518dc7604c34e623abb00a883fe516266aaf061558920785a2a0/bge-python-sdk-0.7.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-22 08:30:21",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "teambge",
"github_project": "bge-python-sdk",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [
{
"name": "aliyun-python-sdk-core",
"specs": []
},
{
"name": "six",
"specs": []
},
{
"name": "certifi",
"specs": []
},
{
"name": "chardet",
"specs": []
},
{
"name": "idna",
"specs": []
},
{
"name": "requests",
"specs": []
},
{
"name": "urllib3",
"specs": []
},
{
"name": "oss2",
"specs": []
},
{
"name": "docker",
"specs": []
},
{
"name": "pimento",
"specs": []
},
{
"name": "qprompt",
"specs": []
},
{
"name": "requests_toolbelt",
"specs": []
},
{
"name": "validator.py",
"specs": []
},
{
"name": "python-minifier",
"specs": []
},
{
"name": "rich",
"specs": []
}
],
"tox": true,
"lcname": "bge-python-sdk"
}