# 简介
用于同步协议管理系统上协议源码到本地,摆脱手动创建文件/复制粘贴源码/替换包名/人工核对协议是否更新等烦恼。 目前只支持Android侧使用,后续计划支持ios侧
```
pcs-get [option] <param_value>
options:
none, - 无选项,更新当前目录层级已存在的协议
-u, --update, - 更新当前目录层级已存在的协议
-f, --feat, - 按需求编号同步协议
-n, --name, - 按协议名称同步协议,如有多个协议名按英文逗号拼接
--set-token, - 可选项,协议管理系统的csrftoken, 用于维持登录状态,可从浏览器开发者工具中查看Header获取
--set-session, - 可选项,协议管理系统的sessionid, 用于维持登录状态,可从浏览器开发者工具中查看Header获取
--set-user, - 可选项,用户名(oa账号),用于cookie过期时的自动登录
--set-password, - 可选项,密码,用于cookie过期时的自动登录
--set-lang, - 协议文件格式,可选:java(默认), kotlin, kotlin-marshallize(TODO),swift(TODO), oc(TODO)
-h, --help, - 帮助
-v, --version, - 查看版本
```
## 安装
```commandline
pip install pcs-get==0.9.23
```
## 配置
需要配置凭据用于登录[协议管理系统](http://protocol.client.bigo.inner/#/protocol)
建议直接配置用户名和密码,会话过期之后会触发自动登录
```commandline
pcs-get --set-user your_account # 协议管理系统账号,应该也是oa账号
pcs-get --set-password your_password
```
当然也可配置浏览器中已有的cookie,但是过期之后需要再次手动更新
```commandline
pcs-get --set-token your_csrftoken
pcs-get --set-session your_sessionid
```
浏览器获取现有cookie看这里
![get-token-session](https://raw.githubusercontent.com/BladesOfTime/pure-img-holder/main/pcs-get/get-token-session.png)
## 使用
建议建新包存放协议类文件,比如需求包是livepass,新建protocol目录作为协议包,先cd到此路径再执行本脚本
可通过IDE的open-in-terminal
![open in terminal](https://raw.githubusercontent.com/BladesOfTime/pure-img-holder/main/pcs-get/open-in-terminal.png)
按需求编号下载该需求的所有协议代码(强制覆盖)
```commandline
pcs-get -f 50308
pcs-get --feat 50308
```
按协议类名称下载协议代码(强制覆盖)
```commandline
pcs-get -n PCS_QryLivePassDetailRes
pcs-get --name PCS_QryLivePassDetailRes,PCS_QryLivePassDetailReq # 多个名称英文逗号拼接
```
更新当前目录下协议类
```commandline
pcs-get
pcs-get -u
pcs-get --update
```
## FAQ
**Q: 稳定性怎么样?**
A: 由于本脚本比较特殊,是客户端个人维护的爬虫模块,非协议管理系统官方出品。如果协议管理系统接口变更,可能就用不了了。因此请始终保证是最新版本,遇到问题请提 [Issues][issues-new]或者直接Q我。
**Q: 代码质量怎么样?**
A: Python小白力作,边看某菜鸟教程边敲的😂,欢迎各位不吝赐教👏🏻
**Q: 如何发布新版本到PyPI**
A: 👉︎[这里](https://juejin.cn/post/7053009657371033630)
Raw data
{
"_id": null,
"home_page": "https://git.sysop.bigo.sg/zhoujianwei.garen/pcs-get",
"name": "pcs-get",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "pcs,bigo,spider",
"author": "zhoujianwei.garen",
"author_email": "zhoujianwei.garen@bigo.com",
"download_url": "https://files.pythonhosted.org/packages/6a/cd/c85a3913b0fc69e291a4baa2d1fe01f33179e7e18fe28b35e387e1b24479/pcs-get-0.9.23.tar.gz",
"platform": "all",
"description": "# \u7b80\u4ecb\n\n\u7528\u4e8e\u540c\u6b65\u534f\u8bae\u7ba1\u7406\u7cfb\u7edf\u4e0a\u534f\u8bae\u6e90\u7801\u5230\u672c\u5730\uff0c\u6446\u8131\u624b\u52a8\u521b\u5efa\u6587\u4ef6/\u590d\u5236\u7c98\u8d34\u6e90\u7801/\u66ff\u6362\u5305\u540d/\u4eba\u5de5\u6838\u5bf9\u534f\u8bae\u662f\u5426\u66f4\u65b0\u7b49\u70e6\u607c\u3002 \u76ee\u524d\u53ea\u652f\u6301Android\u4fa7\u4f7f\u7528\uff0c\u540e\u7eed\u8ba1\u5212\u652f\u6301ios\u4fa7\n\n```\npcs-get [option] <param_value>\noptions:\n none, - \u65e0\u9009\u9879\uff0c\u66f4\u65b0\u5f53\u524d\u76ee\u5f55\u5c42\u7ea7\u5df2\u5b58\u5728\u7684\u534f\u8bae\n -u, --update, - \u66f4\u65b0\u5f53\u524d\u76ee\u5f55\u5c42\u7ea7\u5df2\u5b58\u5728\u7684\u534f\u8bae\n -f, --feat, - \u6309\u9700\u6c42\u7f16\u53f7\u540c\u6b65\u534f\u8bae\n -n, --name, - \u6309\u534f\u8bae\u540d\u79f0\u540c\u6b65\u534f\u8bae\uff0c\u5982\u6709\u591a\u4e2a\u534f\u8bae\u540d\u6309\u82f1\u6587\u9017\u53f7\u62fc\u63a5\n --set-token, - \u53ef\u9009\u9879\uff0c\u534f\u8bae\u7ba1\u7406\u7cfb\u7edf\u7684csrftoken, \u7528\u4e8e\u7ef4\u6301\u767b\u5f55\u72b6\u6001\uff0c\u53ef\u4ece\u6d4f\u89c8\u5668\u5f00\u53d1\u8005\u5de5\u5177\u4e2d\u67e5\u770bHeader\u83b7\u53d6\n --set-session, - \u53ef\u9009\u9879\uff0c\u534f\u8bae\u7ba1\u7406\u7cfb\u7edf\u7684sessionid, \u7528\u4e8e\u7ef4\u6301\u767b\u5f55\u72b6\u6001\uff0c\u53ef\u4ece\u6d4f\u89c8\u5668\u5f00\u53d1\u8005\u5de5\u5177\u4e2d\u67e5\u770bHeader\u83b7\u53d6\n --set-user, - \u53ef\u9009\u9879\uff0c\u7528\u6237\u540d\uff08oa\u8d26\u53f7\uff09\uff0c\u7528\u4e8ecookie\u8fc7\u671f\u65f6\u7684\u81ea\u52a8\u767b\u5f55\n --set-password, - \u53ef\u9009\u9879\uff0c\u5bc6\u7801\uff0c\u7528\u4e8ecookie\u8fc7\u671f\u65f6\u7684\u81ea\u52a8\u767b\u5f55\n --set-lang, - \u534f\u8bae\u6587\u4ef6\u683c\u5f0f\uff0c\u53ef\u9009\uff1ajava(\u9ed8\u8ba4), kotlin, kotlin-marshallize(TODO)\uff0cswift(TODO), oc(TODO)\n -h, --help, - \u5e2e\u52a9\n -v, --version, - \u67e5\u770b\u7248\u672c\n```\n\n## \u5b89\u88c5\n\n```commandline\npip install pcs-get==0.9.23\n```\n\n## \u914d\u7f6e\n\n\u9700\u8981\u914d\u7f6e\u51ed\u636e\u7528\u4e8e\u767b\u5f55[\u534f\u8bae\u7ba1\u7406\u7cfb\u7edf](http://protocol.client.bigo.inner/#/protocol)\n\n\u5efa\u8bae\u76f4\u63a5\u914d\u7f6e\u7528\u6237\u540d\u548c\u5bc6\u7801\uff0c\u4f1a\u8bdd\u8fc7\u671f\u4e4b\u540e\u4f1a\u89e6\u53d1\u81ea\u52a8\u767b\u5f55\n\n```commandline\npcs-get --set-user your_account # \u534f\u8bae\u7ba1\u7406\u7cfb\u7edf\u8d26\u53f7\uff0c\u5e94\u8be5\u4e5f\u662foa\u8d26\u53f7\npcs-get --set-password your_password\n```\n\n\u5f53\u7136\u4e5f\u53ef\u914d\u7f6e\u6d4f\u89c8\u5668\u4e2d\u5df2\u6709\u7684cookie\uff0c\u4f46\u662f\u8fc7\u671f\u4e4b\u540e\u9700\u8981\u518d\u6b21\u624b\u52a8\u66f4\u65b0\n\n```commandline\npcs-get --set-token your_csrftoken\npcs-get --set-session your_sessionid\n```\n\n\u6d4f\u89c8\u5668\u83b7\u53d6\u73b0\u6709cookie\u770b\u8fd9\u91cc\n![get-token-session](https://raw.githubusercontent.com/BladesOfTime/pure-img-holder/main/pcs-get/get-token-session.png)\n\n## \u4f7f\u7528\n\n\u5efa\u8bae\u5efa\u65b0\u5305\u5b58\u653e\u534f\u8bae\u7c7b\u6587\u4ef6\uff0c\u6bd4\u5982\u9700\u6c42\u5305\u662flivepass\uff0c\u65b0\u5efaprotocol\u76ee\u5f55\u4f5c\u4e3a\u534f\u8bae\u5305\uff0c\u5148cd\u5230\u6b64\u8def\u5f84\u518d\u6267\u884c\u672c\u811a\u672c\n\n\u53ef\u901a\u8fc7IDE\u7684open-in-terminal\n\n![open in terminal](https://raw.githubusercontent.com/BladesOfTime/pure-img-holder/main/pcs-get/open-in-terminal.png)\n\n\u6309\u9700\u6c42\u7f16\u53f7\u4e0b\u8f7d\u8be5\u9700\u6c42\u7684\u6240\u6709\u534f\u8bae\u4ee3\u7801\uff08\u5f3a\u5236\u8986\u76d6\uff09\n\n```commandline\npcs-get -f 50308\npcs-get --feat 50308\n```\n\n\u6309\u534f\u8bae\u7c7b\u540d\u79f0\u4e0b\u8f7d\u534f\u8bae\u4ee3\u7801\uff08\u5f3a\u5236\u8986\u76d6\uff09\n\n```commandline\npcs-get -n PCS_QryLivePassDetailRes\npcs-get --name PCS_QryLivePassDetailRes,PCS_QryLivePassDetailReq # \u591a\u4e2a\u540d\u79f0\u82f1\u6587\u9017\u53f7\u62fc\u63a5\n```\n\n\u66f4\u65b0\u5f53\u524d\u76ee\u5f55\u4e0b\u534f\u8bae\u7c7b\n\n```commandline\npcs-get\npcs-get -u\npcs-get --update\n```\n\n## FAQ\n\n**Q: \u7a33\u5b9a\u6027\u600e\u4e48\u6837\uff1f**\n\nA: \u7531\u4e8e\u672c\u811a\u672c\u6bd4\u8f83\u7279\u6b8a\uff0c\u662f\u5ba2\u6237\u7aef\u4e2a\u4eba\u7ef4\u62a4\u7684\u722c\u866b\u6a21\u5757\uff0c\u975e\u534f\u8bae\u7ba1\u7406\u7cfb\u7edf\u5b98\u65b9\u51fa\u54c1\u3002\u5982\u679c\u534f\u8bae\u7ba1\u7406\u7cfb\u7edf\u63a5\u53e3\u53d8\u66f4\uff0c\u53ef\u80fd\u5c31\u7528\u4e0d\u4e86\u4e86\u3002\u56e0\u6b64\u8bf7\u59cb\u7ec8\u4fdd\u8bc1\u662f\u6700\u65b0\u7248\u672c\uff0c\u9047\u5230\u95ee\u9898\u8bf7\u63d0 [Issues][issues-new]\u6216\u8005\u76f4\u63a5Q\u6211\u3002\n\n**Q: \u4ee3\u7801\u8d28\u91cf\u600e\u4e48\u6837\uff1f**\n\nA: Python\u5c0f\u767d\u529b\u4f5c\uff0c\u8fb9\u770b\u67d0\u83dc\u9e1f\u6559\u7a0b\u8fb9\u6572\u7684\ud83d\ude02\uff0c\u6b22\u8fce\u5404\u4f4d\u4e0d\u541d\u8d50\u6559\ud83d\udc4f\ud83c\udffb\n\n**Q: \u5982\u4f55\u53d1\u5e03\u65b0\u7248\u672c\u5230PyPI**\n\nA: \ud83d\udc49\ufe0e[\u8fd9\u91cc](https://juejin.cn/post/7053009657371033630)\n",
"bugtrack_url": null,
"license": "GPLv3+",
"summary": "the spider for pcs-protocol",
"version": "0.9.23",
"project_urls": {
"Homepage": "https://git.sysop.bigo.sg/zhoujianwei.garen/pcs-get"
},
"split_keywords": [
"pcs",
"bigo",
"spider"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "062e8a15a96b6333b92c16ecc2911ddab062279a75fa3ff88214c3baab183970",
"md5": "81da2f8ab1d8a12a4062449e1b80f1f5",
"sha256": "3f7896463bd4b6dd2df7271e617dc9425e16ba2a3cc838d15e1d1b7267b043f4"
},
"downloads": -1,
"filename": "pcs_get-0.9.23-py3-none-any.whl",
"has_sig": false,
"md5_digest": "81da2f8ab1d8a12a4062449e1b80f1f5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 24484,
"upload_time": "2023-07-31T09:50:25",
"upload_time_iso_8601": "2023-07-31T09:50:25.819747Z",
"url": "https://files.pythonhosted.org/packages/06/2e/8a15a96b6333b92c16ecc2911ddab062279a75fa3ff88214c3baab183970/pcs_get-0.9.23-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6acdc85a3913b0fc69e291a4baa2d1fe01f33179e7e18fe28b35e387e1b24479",
"md5": "dd16cd9cf87cce59ddf4c9f3df4f97f6",
"sha256": "1c481820038a011fae3644431cbe79213b9e4933d3dd7d0e3682cd2c92502da0"
},
"downloads": -1,
"filename": "pcs-get-0.9.23.tar.gz",
"has_sig": false,
"md5_digest": "dd16cd9cf87cce59ddf4c9f3df4f97f6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 22532,
"upload_time": "2023-07-31T09:50:28",
"upload_time_iso_8601": "2023-07-31T09:50:28.069719Z",
"url": "https://files.pythonhosted.org/packages/6a/cd/c85a3913b0fc69e291a4baa2d1fe01f33179e7e18fe28b35e387e1b24479/pcs-get-0.9.23.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-31 09:50:28",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "pcs-get"
}