跳转到主要内容

iSmartGate和GogoGate2 API

项目描述

ismartgate

Build Status Documentation Code Coverage

iSmartGate和GogoGate2 API


关于

这是vangorra的优秀的 python_gogogate2_api 库的分支,来自 https://github.com/vangorra/python_gogogate2_api

安装

稳定发布: pip install ismartgate
开发头: pip install git+https://github.com/bdraco/ismartgate.git

在命令中使用

$ gogogate2 --help
Usage: gogogate2 [OPTIONS] COMMAND [ARGS]...

  Interact with the device API.

Options:
  --host TEXT      [required]
  --username TEXT  [required]
  --password TEXT  Omit for interactive prompt. Use '-' to read from stdin.
  --version        Show the version and exit.
  --help           Show this message and exit.

Commands:
  close  Close the door.
  info   Get info from device.
  open   Open the door.


$ ismartgate --help
Usage: ismartgate [OPTIONS] COMMAND [ARGS]...

  Interact with the device API.

Options:
  --host TEXT      [required]
  --username TEXT  [required]
  --password TEXT  Omit for interactive prompt. Use '-' to read from stdin.
  --version        Show the version and exit.
  --help           Show this message and exit.

Commands:
  close  Close the door.
  info   Get info from device.
  open   Open the door.

在代码中使用

from ismartgate import GogoGate2Api, ISmartGateApi

# GogoGate2 API
gogogate2_api = GogoGate2Api("10.10.0.23", "admin", "password")

# Get info about device and all doors.
await gogogate2_api.async_info()

# Open/close door.
await gogogate2_api.async_open_door(1)
await gogogate2_api.async_close_door(1)


# iSmartGate API
ismartgate_api = ISmartGateApi("10.10.0.24", "admin", "password")

# Get info about device and all doors.
await ismartgate_api.async_info()

# Open/close door.
await ismartgate_api.async_open_door(1)
await ismartgate_api.async_close_door(1)

文档

有关完整包文档,请访问 bdraco.github.io/ismartgate

开发

有关与代码开发相关的信息,请参阅 CONTRIBUTING.md

您需要了解的四个命令

  1. pip install -e .[dev]

    这将以可编辑模式安装您的软件包,并包含所有必需的开发依赖项(即 tox)。

  2. make build

    这将运行 tox,它将在Python 3.7和Python 3.8上运行所有测试,并对您的代码进行代码审查。

  3. make clean

    这将清理各种Python和构建生成的文件,以确保您在一个干净的环境中工作。

  4. make docs

    这将生成并启动一个网页浏览器,以查看您Python软件包的最新文档。

额外的可选设置步骤

  • 将您的项目变成GitHub存储库
    • github.com 上创建一个账户
    • 前往 创建一个新的仓库
    • 建议
      • 强烈建议将仓库名称与 Python 包名称保持一致
      • 以下许多可选步骤在仓库公开的情况下是 免费的,开源也很有趣
    • 创建 GitHub 仓库后,运行以下命令: "...或从命令行推送现有仓库"
  • 在 Codecov 上注册您的项目
    • codecov.io 上创建账户(建议使用 GitHub 登录)其他所有事情都会为您处理。
  • 确保您已将 GitHub Pages 设置为通过选择仓库设置中“GitHub Pages”部分的下拉菜单中的 gh-pages 分支来构建 gh-pages 分支。(仓库设置)
  • 在 PyPI 上注册您的项目
    • pypi.org 上创建账户
    • 前往您的 GitHub 仓库设置,在 Secrets 选项卡 下,添加一个名为 PYPI_TOKEN 的秘密,并使用您的 PyPI 账户密码。请不要担心,没有人会看到这个密码,因为它会被加密。
    • 下次您在执行 bump2version 后将分支推送到 main,GitHub Actions 将构建并将您的 Python 包部署到 PyPI。

建议的 Git 分支策略

  1. main 用于最新开发,您几乎不应该直接向此分支提交。GitHub Actions 将在每个推送到此分支和 CRON 操作上运行,但仍建议将提交推送到您的开发分支,并向 main 发起拉取请求。如果您使用 bumpversion 推送带标签的提交,这也会发布到 PyPI。
  2. 您日常的工作应该存在于与 main 分离的分支上。即使只是您一个人在仓库上工作,也应该从您的开发分支向 main 发起拉取请求,以确保您的提交不会破坏开发头。GitHub Actions 将在向任何分支推送或从任何分支向任何其他分支发起拉取请求时运行。
  3. 建议在提交 PR 时使用 "Squash and Merge" 提交。这使得对 main 的每次更改都是原子的,并且作为副作用自然会鼓励小的、定义明确的 PR。

MIT 许可证

项目详情


下载文件

下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于 安装包 的信息。

源分发

ismartgate-5.0.1.tar.gz (31.8 kB 查看哈希值)

上传时间

构建分发

ismartgate-5.0.1-py2.py3-none-any.whl (23.1 kB 查看哈希值)

上传时间 Python 2 Python 3

支持者