alxwrd/specsavers
GitHub: alxwrd/specsavers
Specsavers 预约系统 RESTful API 的 Python 封装库,简化门店查找与预约时段查询流程。
Stars: 3 | Forks: 4
# Specsavers :eyeglasses:
_Specsavers 预约预订 API 的一个 Python 封装_
[](https://travis-ci.org/alxwrd/specsavers)
[](https://pypistats.org/packages/specsavers)
## 示例
```
>>> import specsavers
# 查找本地门店
>>> stores = specsavers.locate(latitude=51.507879, longitude=0.087732)
# 最近的 / 第一家门店
>>> stores[0]
# 按名称查找门店
>>> stores["strand"]
# 直接按名称查找
>>>other_store = specsavers.find("nottingham")
>>> other_store.appointments() # Implies today
[, ]
>>> other_store.appointments("tomorrow")[0]
```
## 是什么?
Specsavers 预订网站由一个 RESTful API 提供支持。这个库
旨在为该服务提供一个简单、易用且符合 Python 风格的接口。
## 为什么?
我最近需要进行一次视力测试,而 Specsavers 支持在线预约。
我需要相当紧急地预约(提前两天),但幸运的是,
还剩下_一个_时间段。我继续进行预约,但在
填写我的详细信息所花费的时间里:它已经被别人预约了。
我想关注新预约的出现,但令人沮丧的是,每次
我刷新页面时,我都会被带回到流程的第一步。
所以我浏览了一下浏览器的开发工具。令我高兴的是,我发现
Specsavers 预订网站是由一个 RESTful API 驱动的。我写了一些
代码来获取所需日期的预约;这样我就可以观察是否有
另一个可用的预约。
最终,我在我想要的那天预约到了。但我不想让我
对 API 的了解白白浪费,所以我创建了这个包!
## 使用
### 安装
_仅支持 Python 3.6+_
```
pip3 install specsavers
```
### 开发环境配置
这个项目使用 [poetry](https://python-poetry.org/docs/) 来管理
依赖项,使用 [pytest](https://docs.pytest.org/en/latest/)
进行测试,以及使用 [pycodestyle](https://github.com/PyCQA/pycodestyle)(前身是 pep8)
进行风格检查。
```
# https://python-poetry.org/docs/#installation
# (如果您还没有)
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
git clone https://github.com//specsavers.git # Clone the repo from your fork
cd specsavers
poetry install # Install all dependencies
poetry shell # Start the new virtual enviroment
# 进行更改
pytest tests # Run tests
pycodestyle specsavers/ tests/ # Check style
```
标签:API封装, Python, RESTful API, 安全规则引擎, 提示词优化, 数字取证, 无后门, 自动化脚本, 逆向工具