Metadata-Version: 2.1
Name: pcs-get
Version: 0.9.8
Summary: the spider for pcs-protocol
Home-page: https://git.sysop.bigo.sg/zhoujianwei.garen/pcs-get
Author: zhoujianwei.garen
Author-email: zhoujianwei.garen@bigo.com
License: GPLv3+
Keywords: pcs,bigo,spider
Platform: all
Classifier: Environment :: Console
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Natural Language :: Chinese (Simplified)
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.8
Description-Content-Type: text/markdown
License-File: LICENSE

# 简介

用于同步协议管理系统上协议源码到本地，摆脱手动创建文件/复制粘贴源码/替换包名/人工核对协议是否更新等烦恼。 目前只支持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
```

## 配置

需要配置凭据用于登录[协议管理系统](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小白力作，边看某菜鸟教程边敲的😂，欢迎各位不吝赐教👏🏻

