├── .codeclimate.yml ├── .github ├── CODEOWNERS ├── FUNDING.yml ├── dependabot.yml ├── labels.yml ├── pr-labeler.yml ├── release-drafter.yml └── workflows │ ├── labeler.yml │ ├── main.yml │ ├── pr-labeler.yaml │ ├── release-drafter.yml │ └── release.yml ├── .gitignore ├── .pre-commit-config.yaml ├── .pylintrc ├── .vscode └── settings.json ├── CHANGELOG.md ├── LICENSE ├── MANIFEST.in ├── README.md ├── poetry.lock ├── poetry.toml ├── pymfy ├── __init__.py └── api │ ├── __init__.py │ ├── devices │ ├── __init__.py │ ├── base.py │ ├── blind.py │ ├── camera_protect.py │ ├── category.py │ ├── roller_shutter.py │ └── thermostat.py │ ├── error.py │ ├── model.py │ └── somfy_api.py ├── pyproject.toml ├── setup.cfg ├── tests ├── __init__.py ├── blind.json ├── camera.json ├── data │ ├── access_token_expired.json │ ├── definition_not_found.json │ ├── device_not_found.json │ ├── invalid_access_token.json │ ├── quota_violation.json │ ├── setup_not_found.json │ ├── site_not_found.json │ └── validate_error.json ├── get_devices_1.json ├── get_devices_2.json ├── get_site.json ├── get_sites.json ├── hvac.json ├── roller_shutter.json ├── roller_shutter_2.json ├── test_blind.py ├── test_camera_protect.py ├── test_roller_shutter.py ├── test_somfy_api.py ├── test_somfy_device.py └── test_thermostat.py └── tox.ini /.codeclimate.yml: -------------------------------------------------------------------------------- 1 | version: "2" # required to adjust maintainability checks 2 | checks: 3 | method-complexity: 4 | config: 5 | threshold: 10 6 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @tetienne 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | custom: ["https://www.paypal.me/ThibautE"] 4 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: github-actions 4 | directory: "/" 5 | schedule: 6 | interval: weekly 7 | - package-ecosystem: pip 8 | directory: "/" 9 | schedule: 10 | interval: weekly 11 | -------------------------------------------------------------------------------- /.github/labels.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # Labels names are important as they are used by Release Drafter to decide 3 | # regarding where to record them in changelog or if to skip them. 4 | # 5 | # The repository labels will be automatically configured using this file and 6 | # the GitHub Action https://github.com/marketplace/actions/github-labeler. 7 | - name: breaking 8 | description: Breaking Changes 9 | color: bfd4f2 10 | - name: bug 11 | description: Something isn't working 12 | color: d73a4a 13 | - name: build 14 | description: Build System and Dependencies 15 | color: bfdadc 16 | - name: ci 17 | description: Continuous Integration 18 | color: 4a97d6 19 | - name: dependencies 20 | description: Pull requests that update a dependency file 21 | color: 0366d6 22 | - name: documentation 23 | description: Improvements or additions to documentation 24 | color: 0075ca 25 | - name: duplicate 26 | description: This issue or pull request already exists 27 | color: cfd3d7 28 | - name: enhancement 29 | description: New feature or request 30 | color: a2eeef 31 | - name: github_actions 32 | description: Pull requests that update Github_actions code 33 | color: "000000" 34 | - name: good first issue 35 | description: Good for newcomers 36 | color: 7057ff 37 | - name: help wanted 38 | description: Extra attention is needed 39 | color: 008672 40 | - name: invalid 41 | description: This doesn't seem right 42 | color: e4e669 43 | - name: performance 44 | description: Performance 45 | color: "016175" 46 | - name: python 47 | description: Pull requests that update Python code 48 | color: 2b67c6 49 | - name: question 50 | description: Further information is requested 51 | color: d876e3 52 | - name: refactoring 53 | description: Refactoring 54 | color: ef67c4 55 | - name: removal 56 | description: Removals and Deprecations 57 | color: 9ae7ea 58 | - name: style 59 | description: Style 60 | color: c120e5 61 | - name: testing 62 | description: Testing 63 | color: b1fc6f 64 | - name: wontfix 65 | description: This will not be worked on 66 | color: ffffff 67 | -------------------------------------------------------------------------------- /.github/pr-labeler.yml: -------------------------------------------------------------------------------- 1 | feature: ['feature/*', 'feat/*'] 2 | enhancement: enhancement/* 3 | bug: fix/* 4 | breaking: breaking/* 5 | documentation: doc/* 6 | ci: ci/* 7 | testing: ['test/*', 'testing/*'] 8 | -------------------------------------------------------------------------------- /.github/release-drafter.yml: -------------------------------------------------------------------------------- 1 | categories: 2 | - title: ":boom: Breaking Changes" 3 | label: "breaking" 4 | - title: ":rocket: Features" 5 | label: "enhancement" 6 | - title: ":fire: Removals and Deprecations" 7 | label: "removal" 8 | - title: ":beetle: Fixes" 9 | label: "bug" 10 | - title: ":racehorse: Performance" 11 | label: "performance" 12 | - title: ":rotating_light: Testing" 13 | label: "testing" 14 | - title: ":construction_worker: Continuous Integration" 15 | label: "ci" 16 | - title: ":books: Documentation" 17 | label: "documentation" 18 | - title: ":hammer: Refactoring" 19 | label: "refactoring" 20 | - title: ":lipstick: Style" 21 | label: "style" 22 | - title: ":package: Dependencies" 23 | labels: 24 | - "dependencies" 25 | - "build" 26 | template: | 27 | ## Changes 28 | 29 | $CHANGES 30 | -------------------------------------------------------------------------------- /.github/workflows/labeler.yml: -------------------------------------------------------------------------------- 1 | name: Labeler 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - master 8 | 9 | jobs: 10 | labeler: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Check out the repository 14 | uses: actions/checkout@v2.3.4 15 | 16 | - name: Run Labeler 17 | uses: crazy-max/ghaction-github-labeler@v3.1.1 18 | with: 19 | skip-delete: true 20 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | tests: 13 | name: "Python ${{ matrix.python-version }}" 14 | runs-on: "ubuntu-latest" 15 | 16 | strategy: 17 | matrix: 18 | python-version: ["3.6", "3.7", "3.8", "3.9"] 19 | 20 | steps: 21 | - uses: "actions/checkout@v2.3.4" 22 | - uses: "actions/setup-python@v2" 23 | with: 24 | python-version: "${{ matrix.python-version }}" 25 | 26 | - name: Install and set up Poetry 27 | run: | 28 | curl -o get-poetry.py https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py 29 | python get-poetry.py -y 30 | 31 | - name: "Install tox" 32 | run: | 33 | python -m pip install --upgrade tox tox-gh-actions 34 | - name: "Run tox targets for ${{ matrix.python-version }}" 35 | run: | 36 | source $HOME/.poetry/env 37 | python -m tox -- --cov=pymfy --cov-report xml 38 | 39 | - name: Publish code coverage 40 | uses: paambaati/codeclimate-action@v2.7.4 41 | env: 42 | CC_TEST_REPORTER_ID: ${{secrets.TEST_REPORTER_ID}} 43 | with: 44 | coverageLocations: | 45 | coverage.xml 46 | -------------------------------------------------------------------------------- /.github/workflows/pr-labeler.yaml: -------------------------------------------------------------------------------- 1 | name: PR Labeler 2 | on: 3 | pull_request: 4 | types: [opened] 5 | 6 | jobs: 7 | pr-labeler: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: TimonVS/pr-labeler-action@v3 11 | env: 12 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 13 | -------------------------------------------------------------------------------- /.github/workflows/release-drafter.yml: -------------------------------------------------------------------------------- 1 | name: Release Drafter 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | update_release_draft: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Update release draft 13 | uses: release-drafter/release-drafter@v5 14 | env: 15 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 16 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | - master 8 | 9 | jobs: 10 | release: 11 | name: Release 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: Check out the repository 15 | uses: actions/checkout@v2.3.4 16 | with: 17 | fetch-depth: 2 18 | 19 | - name: Set up Python 20 | uses: actions/setup-python@v2.2.2 21 | with: 22 | python-version: "3.7" 23 | 24 | - name: Install and set up Poetry 25 | uses: abatilo/actions-poetry@v2.1.2 26 | 27 | - name: Check if there is a parent commit 28 | id: check-parent-commit 29 | run: | 30 | echo "::set-output name=sha::$(git rev-parse --verify --quiet HEAD^)" 31 | 32 | - name: Detect and tag new version 33 | id: check-version 34 | if: steps.check-parent-commit.outputs.sha 35 | uses: salsify/action-detect-and-tag-new-version@v2.0.1 36 | with: 37 | version-command: | 38 | bash -o pipefail -c "poetry version | awk '{ print \$2 }'" 39 | 40 | - name: Build package 41 | run: | 42 | poetry build --ansi 43 | 44 | - name: Publish package on PyPI 45 | if: steps.check-version.outputs.tag 46 | uses: pypa/gh-action-pypi-publish@v1.4.2 47 | with: 48 | user: __token__ 49 | password: ${{ secrets.PYPI_API_TOKEN }} 50 | 51 | - name: Publish the release notes 52 | uses: release-drafter/release-drafter@v5.15.0 53 | with: 54 | publish: ${{ steps.check-version.outputs.tag != '' }} 55 | tag: ${{ steps.check-version.outputs.tag }} 56 | env: 57 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 58 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | MANIFEST 27 | 28 | # PyInstaller 29 | # Usually these files are written by a python script from a template 30 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 31 | *.manifest 32 | *.spec 33 | 34 | # Installer logs 35 | pip-log.txt 36 | pip-delete-this-directory.txt 37 | 38 | # Unit test / coverage reports 39 | htmlcov/ 40 | .tox/ 41 | .coverage 42 | .coverage.* 43 | .cache 44 | nosetests.xml 45 | coverage.xml 46 | *.cover 47 | .hypothesis/ 48 | .pytest_cache/ 49 | 50 | # Translations 51 | *.mo 52 | *.pot 53 | 54 | # Django stuff: 55 | *.log 56 | local_settings.py 57 | db.sqlite3 58 | 59 | # Flask stuff: 60 | instance/ 61 | .webassets-cache 62 | 63 | # Scrapy stuff: 64 | .scrapy 65 | 66 | # Sphinx documentation 67 | docs/_build/ 68 | 69 | # PyBuilder 70 | target/ 71 | 72 | # Jupyter Notebook 73 | .ipynb_checkpoints 74 | 75 | # pyenv 76 | .python-version 77 | 78 | # celery beat schedule file 79 | celerybeat-schedule 80 | 81 | # SageMath parsed files 82 | *.sage.py 83 | 84 | # Environments 85 | .env 86 | .venv 87 | env/ 88 | venv/ 89 | ENV/ 90 | env.bak/ 91 | venv.bak/ 92 | 93 | # Spyder project settings 94 | .spyderproject 95 | .spyproject 96 | 97 | # Rope project settings 98 | .ropeproject 99 | 100 | # mkdocs documentation 101 | /site 102 | 103 | # mypy 104 | .mypy_cache/ 105 | 106 | # PyCharm 107 | /.idea/* 108 | -------------------------------------------------------------------------------- /.pre-commit-config.yaml: -------------------------------------------------------------------------------- 1 | repos: 2 | - repo: https://github.com/pre-commit/pre-commit-hooks 3 | rev: v2.5.0 4 | hooks: 5 | - id: check-json 6 | - id: check-yaml 7 | - id: trailing-whitespace 8 | - id: end-of-file-fixer 9 | - repo: local 10 | hooks: 11 | - id: black 12 | name: black 13 | entry: black 14 | language: system 15 | types: [ python ] 16 | - id: flake8 17 | name: flake8 18 | entry: flake8 19 | language: system 20 | types: [ python ] 21 | - id: isort 22 | name: isort 23 | entry: isort 24 | language: system 25 | types: [ python ] 26 | - id: pyupgrade 27 | name: pyupgrade 28 | entry: pyupgrade 29 | args: ["--py36-plus"] 30 | language: system 31 | types: [ python ] 32 | - id: mypy 33 | name: mypy 34 | entry: mypy 35 | language: system 36 | types: [ python ] 37 | - id: pylint 38 | name: pylint 39 | entry: pylint 40 | language: system 41 | types: [ python ] 42 | -------------------------------------------------------------------------------- /.pylintrc: -------------------------------------------------------------------------------- 1 | [BASIC] 2 | good-names=id 3 | 4 | [LOGGING] 5 | logging-format-style=new 6 | 7 | [MESSAGES CONTROL] 8 | disable= 9 | missing-module-docstring, 10 | missing-class-docstring, 11 | missing-function-docstring, 12 | no-self-use, 13 | too-few-public-methods, 14 | too-many-public-methods, 15 | too-many-arguments, 16 | bad-continuation, 17 | import-error, 18 | unsubscriptable-object, 19 | fixme, 20 | pointless-string-statement, 21 | redefined-builtin 22 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.linting.pylintEnabled": true, 3 | "python.testing.pytestEnabled": true, 4 | "python.pythonPath": ".venv/bin/python", 5 | "python.formatting.provider": "black", 6 | "python.languageServer": "Pylance", 7 | "python.linting.flake8Enabled": true, 8 | "python.linting.mypyEnabled": true 9 | } 10 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ### 0.10.0 2 | * Drop support for Python 3.4 and 3.5 3 | * Add support for Python 3.9 4 | * Sync pre-commit dependencies with poetry 5 | * Allow user-agent override 6 | ### 0.9.3 7 | * Add geofencing mode for the thermostat 8 | ### 0.9.2 9 | * Various small fixes for the Thermostat 10 | ### 0.9.1 11 | * Handle error 404 when site has not device 12 | ### 0.9.0 13 | * Add parent id support 14 | ### 0.8.0 15 | * Complete thermostat model 16 | ### 0.7.1 17 | * Support optional condition 18 | * Don't break when new parameters are returned by Somfy 19 | * Fix camera protect model 20 | ### 0.7.0 21 | * Fix Thermostat: get_derogation_*_date -> get_target_*_date 22 | ### 0.6.1 23 | * No more abstract class 24 | * Don't use the built-in token refresh mechanism of OAuth2 session to allow overriding the token refresh logic 25 | ### 0.6.0 26 | * Remove typing library for Python 3.5+ 27 | * Made get and post methods abstract to allow custom implementations 28 | ### 0.5.2 29 | * Remove some workaround due to Somfy limitation 30 | * Allow to provide state during OAuth process 31 | ### 0.5.1 32 | * Made redirect uri optional 33 | ### 0.5.0 34 | * Expose token updater method 35 | * Remove default token updater (token save as file) 36 | ### 0.4.4 37 | * Use get_state method to get blind orientation 38 | * Set 0 as orientation when not available for the blind 39 | ### 0.4.3 40 | * Token can now be fetch using the code instead of the full authorization response 41 | ### 0.4.2 42 | * Raise an HTTPError when Somfy API returns a status code not ok 43 | ### 0.4.1 44 | * Fix command always rejected 45 | ### 0.4.0 46 | * Implicit automatic token refresh 47 | ### 0.3.2 48 | * Fix Thermostat class name 49 | ### O.3.0 50 | * Add thermostat support 51 | * Add camera support 52 | * Add low speed support for roller shutters 53 | * roller shutter position is no more a property 54 | ### 0.2.2 55 | * Add orientation support for blind 56 | ### 0.2.1 57 | * Fix package generation 58 | ### 0.2.0 59 | * Add blind support 60 | ### 0.1.0 61 | * Add support for roller shutters 62 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.md LICENSE pymfy/__version__.py 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 |

4 |

5 | 6 | 7 | 8 | 9 | 10 |

11 | 12 | This library is an attempt to implement the entire Somfy API in Python 3. 13 | Documentation for the Somfy API can be found [here](https://developer.somfy.com/somfy-open-api/apis). 14 | 15 | ## Get developer credentials 16 | 17 | 1. Vist https://developer.somfy.com 18 | 2. Create an account 19 | 3. Open the _My Apps_ menu 20 | 4. Add a new App (for testing, redirect url can be anything in https) 21 | 5. Plug in your details into the test script below. 22 | 23 | ## Supported devices 24 | 25 | Somfy currently exposes the following type of devices: 26 | 27 | - [Blinds](https://developer.somfy.com/products/blinds-interior-and-exterior) 28 | - [Rolling shutters](https://developer.somfy.com/products/rolling-shutters) 29 | - [Cameras](https://developer.somfy.com/products/cameras) 30 | - [Connected Thermostat](https://developer.somfy.com/products/connected-thermostat) 31 | 32 | If you find on this [page](https://developer.somfy.com/products-services-informations) devices not yet handle by this 33 | repository, don't hesitate to open an issue. 34 | 35 | ## Installation 36 | 37 | ``` 38 | pip install pymfy 39 | ``` 40 | 41 | ## Limitation 42 | 43 | Somfy support sent the following message to third party applications using their API. 44 | 45 | ``` 46 | Dear customer, 47 | 48 | As you might have noticed, we have updated the quota policy of the Somfy Open API, in an ongoing effort to provide the best services to our users. 49 | 50 | We are contacting you today to inform you about the new rules we are now applying to the API: 51 | - First of all, no limitation will be applied on the POST /device/{deviceId}/exec endpoint as we want to provide you a total freedom on controlling your devices. 52 | - On the other hand, polling frequency on the GET /site and child endpoints will now have to be under 1 call per minute. 53 | 54 | To preserve an efficient and available service to any of our users, we want to keep the usage of the Open API to a usable but reasonable level to everybody. As we will keep monitoring the generated traffic and the potential impacts, be aware that we do reserve the rights to modify the authorized polling frequency or take any additional measure at any time as stated in our General Terms of Use. 55 | 56 | Thank you for your understanding. 57 | ``` 58 | 59 | ## Example usage 60 | 61 | Print all covers position. 62 | 63 | ```python 64 | import os 65 | import json 66 | from urllib.parse import urlparse, parse_qs 67 | 68 | from pymfy.api.devices.roller_shutter import RollerShutter 69 | from pymfy.api.somfy_api import SomfyApi 70 | from pymfy.api.devices.category import Category 71 | 72 | client_id = r"" # Consumer Key 73 | redir_url = "" # Callback URL (for testing, can be anything) 74 | secret = r"" # Consumer Secret 75 | 76 | 77 | def get_token(): 78 | try: 79 | with open(cache_path, "r") as cache: 80 | return json.loads(cache.read()) 81 | except IOError: 82 | pass 83 | 84 | 85 | def set_token(token) -> None: 86 | with open(cache_path, "w") as cache: 87 | cache.write(json.dumps(token)) 88 | 89 | 90 | cache_path = "/optional/cache/path" 91 | api = SomfyApi(client_id, secret, redir_url, token=get_token(), token_updater=set_token) 92 | if not os.path.isfile(cache_path): 93 | authorization_url, _ = api.get_authorization_url() 94 | print("Please go to {} and authorize access.".format(authorization_url)) 95 | authorization_response = input("Enter the full callback URL") 96 | code = parse_qs(urlparse(authorization_response).query)["code"][0] 97 | set_token(api.request_token(code=code)) 98 | 99 | site_ids = api.get_sites() 100 | devices = api.get_devices(site_ids[0], category=Category.ROLLER_SHUTTER) 101 | 102 | covers = [RollerShutter(d, api) for d in devices] 103 | 104 | for cover in covers: 105 | print( 106 | "Cover {} has the following position: {}".format( 107 | cover.device.name, cover.get_position() 108 | ) 109 | ) 110 | ``` 111 | 112 | ## Contribute 113 | 114 | The current [documentation](https://developer.somfy.com/products-services-informations) does not give enough information to implement all the devices. 115 | If you want to contribute to this repository adding new devices, you can create an issue with the output of this script: 116 | 117 | ```python 118 | import json 119 | import re 120 | from urllib.parse import urlparse, parse_qs 121 | from pymfy.api.somfy_api import SomfyApi 122 | 123 | 124 | client_id = r"" # Consumer Key 125 | redir_url = "" # Callback URL (for testing, can be anything) 126 | secret = r"" # Consumer Secret 127 | 128 | api = SomfyApi(client_id, secret, redir_url) 129 | authorization_url, _ = api.get_authorization_url() 130 | print("Please go to {} and authorize access.".format(authorization_url)) 131 | authorization_response = input("Enter the full callback URL") 132 | code = parse_qs(urlparse(authorization_response).query)["code"][0] 133 | api.request_token(code=code) 134 | 135 | site_ids = [s.id for s in api.get_sites()] 136 | devices = [api.get("/site/" + s_id + "/device").json() for s_id in site_ids] 137 | 138 | # Remove personal information 139 | dumps = json.dumps(devices, sort_keys=True, indent=4, separators=(",", ": ")) 140 | dumps = re.sub('".*id.*": ".*",\n', "", dumps) 141 | 142 | print(dumps) 143 | ``` 144 | -------------------------------------------------------------------------------- /poetry.lock: -------------------------------------------------------------------------------- 1 | [[package]] 2 | name = "appdirs" 3 | version = "1.4.4" 4 | description = "A small Python module for determining appropriate platform-specific dirs, e.g. a \"user data dir\"." 5 | category = "dev" 6 | optional = false 7 | python-versions = "*" 8 | 9 | [[package]] 10 | name = "astroid" 11 | version = "2.6.5" 12 | description = "An abstract syntax tree for Python with inference support." 13 | category = "dev" 14 | optional = false 15 | python-versions = "~=3.6" 16 | 17 | [package.dependencies] 18 | lazy-object-proxy = ">=1.4.0" 19 | typed-ast = {version = ">=1.4.0,<1.5", markers = "implementation_name == \"cpython\" and python_version < \"3.8\""} 20 | typing-extensions = {version = ">=3.7.4", markers = "python_version < \"3.8\""} 21 | wrapt = ">=1.11,<1.13" 22 | 23 | [[package]] 24 | name = "atomicwrites" 25 | version = "1.4.0" 26 | description = "Atomic file writes." 27 | category = "dev" 28 | optional = false 29 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 30 | 31 | [[package]] 32 | name = "attrs" 33 | version = "20.3.0" 34 | description = "Classes Without Boilerplate" 35 | category = "dev" 36 | optional = false 37 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 38 | 39 | [package.extras] 40 | dev = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface", "furo", "sphinx", "pre-commit"] 41 | docs = ["furo", "sphinx", "zope.interface"] 42 | tests = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six", "zope.interface"] 43 | tests_no_zope = ["coverage[toml] (>=5.0.2)", "hypothesis", "pympler", "pytest (>=4.3.0)", "six"] 44 | 45 | [[package]] 46 | name = "black" 47 | version = "20.8b1" 48 | description = "The uncompromising code formatter." 49 | category = "dev" 50 | optional = false 51 | python-versions = ">=3.6" 52 | 53 | [package.dependencies] 54 | appdirs = "*" 55 | click = ">=7.1.2" 56 | dataclasses = {version = ">=0.6", markers = "python_version < \"3.7\""} 57 | mypy-extensions = ">=0.4.3" 58 | pathspec = ">=0.6,<1" 59 | regex = ">=2020.1.8" 60 | toml = ">=0.10.1" 61 | typed-ast = ">=1.4.0" 62 | typing-extensions = ">=3.7.4" 63 | 64 | [package.extras] 65 | colorama = ["colorama (>=0.4.3)"] 66 | d = ["aiohttp (>=3.3.2)", "aiohttp-cors"] 67 | 68 | [[package]] 69 | name = "certifi" 70 | version = "2020.12.5" 71 | description = "Python package for providing Mozilla's CA Bundle." 72 | category = "main" 73 | optional = false 74 | python-versions = "*" 75 | 76 | [[package]] 77 | name = "cfgv" 78 | version = "3.0.0" 79 | description = "Validate configuration and produce human readable error messages." 80 | category = "dev" 81 | optional = false 82 | python-versions = ">=3.6" 83 | 84 | [[package]] 85 | name = "chardet" 86 | version = "3.0.4" 87 | description = "Universal encoding detector for Python 2 and 3" 88 | category = "main" 89 | optional = false 90 | python-versions = "*" 91 | 92 | [[package]] 93 | name = "click" 94 | version = "7.1.2" 95 | description = "Composable command line interface toolkit" 96 | category = "dev" 97 | optional = false 98 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 99 | 100 | [[package]] 101 | name = "colorama" 102 | version = "0.4.4" 103 | description = "Cross-platform colored terminal text." 104 | category = "dev" 105 | optional = false 106 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 107 | 108 | [[package]] 109 | name = "coverage" 110 | version = "5.5" 111 | description = "Code coverage measurement for Python" 112 | category = "dev" 113 | optional = false 114 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4" 115 | 116 | [package.extras] 117 | toml = ["toml"] 118 | 119 | [[package]] 120 | name = "dataclasses" 121 | version = "0.8" 122 | description = "A backport of the dataclasses module for Python 3.6" 123 | category = "dev" 124 | optional = false 125 | python-versions = ">=3.6, <3.7" 126 | 127 | [[package]] 128 | name = "distlib" 129 | version = "0.3.1" 130 | description = "Distribution utilities" 131 | category = "dev" 132 | optional = false 133 | python-versions = "*" 134 | 135 | [[package]] 136 | name = "filelock" 137 | version = "3.0.12" 138 | description = "A platform independent file lock." 139 | category = "dev" 140 | optional = false 141 | python-versions = "*" 142 | 143 | [[package]] 144 | name = "flake8" 145 | version = "3.9.2" 146 | description = "the modular source code checker: pep8 pyflakes and co" 147 | category = "dev" 148 | optional = false 149 | python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" 150 | 151 | [package.dependencies] 152 | importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} 153 | mccabe = ">=0.6.0,<0.7.0" 154 | pycodestyle = ">=2.7.0,<2.8.0" 155 | pyflakes = ">=2.3.0,<2.4.0" 156 | 157 | [[package]] 158 | name = "httpretty" 159 | version = "1.1.4" 160 | description = "HTTP client mock for Python" 161 | category = "dev" 162 | optional = false 163 | python-versions = ">=3" 164 | 165 | [[package]] 166 | name = "identify" 167 | version = "1.5.10" 168 | description = "File identification library for Python" 169 | category = "dev" 170 | optional = false 171 | python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" 172 | 173 | [package.extras] 174 | license = ["editdistance"] 175 | 176 | [[package]] 177 | name = "idna" 178 | version = "2.10" 179 | description = "Internationalized Domain Names in Applications (IDNA)" 180 | category = "main" 181 | optional = false 182 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 183 | 184 | [[package]] 185 | name = "importlib-metadata" 186 | version = "2.1.1" 187 | description = "Read metadata from Python packages" 188 | category = "dev" 189 | optional = false 190 | python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" 191 | 192 | [package.dependencies] 193 | zipp = ">=0.5" 194 | 195 | [package.extras] 196 | docs = ["sphinx", "rst.linker"] 197 | testing = ["packaging", "pep517", "unittest2", "importlib-resources (>=1.3)"] 198 | 199 | [[package]] 200 | name = "importlib-resources" 201 | version = "3.3.0" 202 | description = "Read resources from Python packages" 203 | category = "dev" 204 | optional = false 205 | python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,>=2.7" 206 | 207 | [package.dependencies] 208 | zipp = {version = ">=0.4", markers = "python_version < \"3.8\""} 209 | 210 | [package.extras] 211 | docs = ["sphinx", "rst.linker", "jaraco.packaging"] 212 | 213 | [[package]] 214 | name = "iniconfig" 215 | version = "1.1.1" 216 | description = "iniconfig: brain-dead simple config-ini parsing" 217 | category = "dev" 218 | optional = false 219 | python-versions = "*" 220 | 221 | [[package]] 222 | name = "isort" 223 | version = "5.9.3" 224 | description = "A Python utility / library to sort Python imports." 225 | category = "dev" 226 | optional = false 227 | python-versions = ">=3.6.1,<4.0" 228 | 229 | [package.extras] 230 | pipfile_deprecated_finder = ["pipreqs", "requirementslib"] 231 | requirements_deprecated_finder = ["pipreqs", "pip-api"] 232 | colors = ["colorama (>=0.4.3,<0.5.0)"] 233 | plugins = ["setuptools"] 234 | 235 | [[package]] 236 | name = "lazy-object-proxy" 237 | version = "1.4.3" 238 | description = "A fast and thorough lazy object proxy." 239 | category = "dev" 240 | optional = false 241 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 242 | 243 | [[package]] 244 | name = "mccabe" 245 | version = "0.6.1" 246 | description = "McCabe checker, plugin for flake8" 247 | category = "dev" 248 | optional = false 249 | python-versions = "*" 250 | 251 | [[package]] 252 | name = "mypy" 253 | version = "0.812" 254 | description = "Optional static typing for Python" 255 | category = "dev" 256 | optional = false 257 | python-versions = ">=3.5" 258 | 259 | [package.dependencies] 260 | mypy-extensions = ">=0.4.3,<0.5.0" 261 | typed-ast = ">=1.4.0,<1.5.0" 262 | typing-extensions = ">=3.7.4" 263 | 264 | [package.extras] 265 | dmypy = ["psutil (>=4.0)"] 266 | 267 | [[package]] 268 | name = "mypy-extensions" 269 | version = "0.4.3" 270 | description = "Experimental type system extensions for programs checked with the mypy typechecker." 271 | category = "dev" 272 | optional = false 273 | python-versions = "*" 274 | 275 | [[package]] 276 | name = "nodeenv" 277 | version = "1.5.0" 278 | description = "Node.js virtual environment builder" 279 | category = "dev" 280 | optional = false 281 | python-versions = "*" 282 | 283 | [[package]] 284 | name = "oauthlib" 285 | version = "3.1.0" 286 | description = "A generic, spec-compliant, thorough implementation of the OAuth request-signing logic" 287 | category = "main" 288 | optional = false 289 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 290 | 291 | [package.extras] 292 | rsa = ["cryptography"] 293 | signals = ["blinker"] 294 | signedtoken = ["cryptography", "pyjwt (>=1.0.0)"] 295 | 296 | [[package]] 297 | name = "packaging" 298 | version = "20.7" 299 | description = "Core utilities for Python packages" 300 | category = "dev" 301 | optional = false 302 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 303 | 304 | [package.dependencies] 305 | pyparsing = ">=2.0.2" 306 | 307 | [[package]] 308 | name = "pathspec" 309 | version = "0.8.1" 310 | description = "Utility library for gitignore style pattern matching of file paths." 311 | category = "dev" 312 | optional = false 313 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 314 | 315 | [[package]] 316 | name = "pluggy" 317 | version = "0.13.1" 318 | description = "plugin and hook calling mechanisms for python" 319 | category = "dev" 320 | optional = false 321 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 322 | 323 | [package.dependencies] 324 | importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} 325 | 326 | [package.extras] 327 | dev = ["pre-commit", "tox"] 328 | 329 | [[package]] 330 | name = "pre-commit" 331 | version = "2.14.0" 332 | description = "A framework for managing and maintaining multi-language pre-commit hooks." 333 | category = "dev" 334 | optional = false 335 | python-versions = ">=3.6.1" 336 | 337 | [package.dependencies] 338 | cfgv = ">=2.0.0" 339 | identify = ">=1.0.0" 340 | importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} 341 | importlib-resources = {version = "*", markers = "python_version < \"3.7\""} 342 | nodeenv = ">=0.11.1" 343 | pyyaml = ">=5.1" 344 | toml = "*" 345 | virtualenv = ">=20.0.8" 346 | 347 | [[package]] 348 | name = "py" 349 | version = "1.9.0" 350 | description = "library with cross-python path, ini-parsing, io, code, log facilities" 351 | category = "dev" 352 | optional = false 353 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 354 | 355 | [[package]] 356 | name = "pycodestyle" 357 | version = "2.7.0" 358 | description = "Python style guide checker" 359 | category = "dev" 360 | optional = false 361 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 362 | 363 | [[package]] 364 | name = "pyflakes" 365 | version = "2.3.0" 366 | description = "passive checker of Python programs" 367 | category = "dev" 368 | optional = false 369 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 370 | 371 | [[package]] 372 | name = "pylint" 373 | version = "2.9.6" 374 | description = "python code static checker" 375 | category = "dev" 376 | optional = false 377 | python-versions = "~=3.6" 378 | 379 | [package.dependencies] 380 | astroid = ">=2.6.5,<2.7" 381 | colorama = {version = "*", markers = "sys_platform == \"win32\""} 382 | isort = ">=4.2.5,<6" 383 | mccabe = ">=0.6,<0.7" 384 | toml = ">=0.7.1" 385 | 386 | [[package]] 387 | name = "pyparsing" 388 | version = "2.4.7" 389 | description = "Python parsing module" 390 | category = "dev" 391 | optional = false 392 | python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" 393 | 394 | [[package]] 395 | name = "pytest" 396 | version = "6.2.4" 397 | description = "pytest: simple powerful testing with Python" 398 | category = "dev" 399 | optional = false 400 | python-versions = ">=3.6" 401 | 402 | [package.dependencies] 403 | atomicwrites = {version = ">=1.0", markers = "sys_platform == \"win32\""} 404 | attrs = ">=19.2.0" 405 | colorama = {version = "*", markers = "sys_platform == \"win32\""} 406 | importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} 407 | iniconfig = "*" 408 | packaging = "*" 409 | pluggy = ">=0.12,<1.0.0a1" 410 | py = ">=1.8.2" 411 | toml = "*" 412 | 413 | [package.extras] 414 | testing = ["argcomplete", "hypothesis (>=3.56)", "mock", "nose", "requests", "xmlschema"] 415 | 416 | [[package]] 417 | name = "pytest-cov" 418 | version = "2.12.1" 419 | description = "Pytest plugin for measuring coverage." 420 | category = "dev" 421 | optional = false 422 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 423 | 424 | [package.dependencies] 425 | coverage = ">=5.2.1" 426 | pytest = ">=4.6" 427 | toml = "*" 428 | 429 | [package.extras] 430 | testing = ["fields", "hunter", "process-tests", "six", "pytest-xdist", "virtualenv"] 431 | 432 | [[package]] 433 | name = "pyupgrade" 434 | version = "2.23.0" 435 | description = "A tool to automatically upgrade syntax for newer versions." 436 | category = "dev" 437 | optional = false 438 | python-versions = ">=3.6.1" 439 | 440 | [package.dependencies] 441 | tokenize-rt = ">=3.2.0" 442 | 443 | [[package]] 444 | name = "pyyaml" 445 | version = "5.3.1" 446 | description = "YAML parser and emitter for Python" 447 | category = "dev" 448 | optional = false 449 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 450 | 451 | [[package]] 452 | name = "regex" 453 | version = "2020.11.13" 454 | description = "Alternative regular expression module, to replace re." 455 | category = "dev" 456 | optional = false 457 | python-versions = "*" 458 | 459 | [[package]] 460 | name = "requests" 461 | version = "2.25.0" 462 | description = "Python HTTP for Humans." 463 | category = "main" 464 | optional = false 465 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" 466 | 467 | [package.dependencies] 468 | certifi = ">=2017.4.17" 469 | chardet = ">=3.0.2,<4" 470 | idna = ">=2.5,<3" 471 | urllib3 = ">=1.21.1,<1.27" 472 | 473 | [package.extras] 474 | security = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)"] 475 | socks = ["PySocks (>=1.5.6,!=1.5.7)", "win-inet-pton"] 476 | 477 | [[package]] 478 | name = "requests-oauthlib" 479 | version = "1.3.0" 480 | description = "OAuthlib authentication support for Requests." 481 | category = "main" 482 | optional = false 483 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" 484 | 485 | [package.dependencies] 486 | oauthlib = ">=3.0.0" 487 | requests = ">=2.0.0" 488 | 489 | [package.extras] 490 | rsa = ["oauthlib[signedtoken] (>=3.0.0)"] 491 | 492 | [[package]] 493 | name = "six" 494 | version = "1.15.0" 495 | description = "Python 2 and 3 compatibility utilities" 496 | category = "dev" 497 | optional = false 498 | python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*" 499 | 500 | [[package]] 501 | name = "tokenize-rt" 502 | version = "4.0.0" 503 | description = "A wrapper around the stdlib `tokenize` which roundtrips." 504 | category = "dev" 505 | optional = false 506 | python-versions = ">=3.6.1" 507 | 508 | [[package]] 509 | name = "toml" 510 | version = "0.10.2" 511 | description = "Python Library for Tom's Obvious, Minimal Language" 512 | category = "dev" 513 | optional = false 514 | python-versions = ">=2.6, !=3.0.*, !=3.1.*, !=3.2.*" 515 | 516 | [[package]] 517 | name = "tox" 518 | version = "3.24.1" 519 | description = "tox is a generic virtualenv management and test command line tool" 520 | category = "dev" 521 | optional = false 522 | python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7" 523 | 524 | [package.dependencies] 525 | colorama = {version = ">=0.4.1", markers = "platform_system == \"Windows\""} 526 | filelock = ">=3.0.0" 527 | importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} 528 | packaging = ">=14" 529 | pluggy = ">=0.12.0" 530 | py = ">=1.4.17" 531 | six = ">=1.14.0" 532 | toml = ">=0.9.4" 533 | virtualenv = ">=16.0.0,<20.0.0 || >20.0.0,<20.0.1 || >20.0.1,<20.0.2 || >20.0.2,<20.0.3 || >20.0.3,<20.0.4 || >20.0.4,<20.0.5 || >20.0.5,<20.0.6 || >20.0.6,<20.0.7 || >20.0.7" 534 | 535 | [package.extras] 536 | docs = ["pygments-github-lexers (>=0.0.5)", "sphinx (>=2.0.0)", "sphinxcontrib-autoprogram (>=0.1.5)", "towncrier (>=18.5.0)"] 537 | testing = ["flaky (>=3.4.0)", "freezegun (>=0.3.11)", "psutil (>=5.6.1)", "pytest (>=4.0.0)", "pytest-cov (>=2.5.1)", "pytest-mock (>=1.10.0)", "pytest-randomly (>=1.0.0)", "pytest-xdist (>=1.22.2)", "pathlib2 (>=2.3.3)"] 538 | 539 | [[package]] 540 | name = "typed-ast" 541 | version = "1.4.1" 542 | description = "a fork of Python 2 and 3 ast modules with type comment support" 543 | category = "dev" 544 | optional = false 545 | python-versions = "*" 546 | 547 | [[package]] 548 | name = "typing-extensions" 549 | version = "3.7.4.3" 550 | description = "Backported and Experimental Type Hints for Python 3.5+" 551 | category = "dev" 552 | optional = false 553 | python-versions = "*" 554 | 555 | [[package]] 556 | name = "urllib3" 557 | version = "1.22" 558 | description = "HTTP library with thread-safe connection pooling, file post, and more." 559 | category = "main" 560 | optional = false 561 | python-versions = "*" 562 | 563 | [package.extras] 564 | secure = ["pyOpenSSL (>=0.14)", "cryptography (>=1.3.4)", "idna (>=2.0.0)", "certifi", "ipaddress"] 565 | socks = ["PySocks (>=1.5.6,!=1.5.7,<2.0)"] 566 | 567 | [[package]] 568 | name = "virtualenv" 569 | version = "20.2.1" 570 | description = "Virtual Python Environment builder" 571 | category = "dev" 572 | optional = false 573 | python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,>=2.7" 574 | 575 | [package.dependencies] 576 | appdirs = ">=1.4.3,<2" 577 | distlib = ">=0.3.1,<1" 578 | filelock = ">=3.0.0,<4" 579 | importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} 580 | importlib-resources = {version = ">=1.0", markers = "python_version < \"3.7\""} 581 | six = ">=1.9.0,<2" 582 | 583 | [package.extras] 584 | docs = ["proselint (>=0.10.2)", "sphinx (>=3)", "sphinx-argparse (>=0.2.5)", "sphinx-rtd-theme (>=0.4.3)", "towncrier (>=19.9.0rc1)"] 585 | testing = ["coverage (>=4)", "coverage-enable-subprocess (>=1)", "flaky (>=3)", "pytest (>=4)", "pytest-env (>=0.6.2)", "pytest-freezegun (>=0.4.1)", "pytest-mock (>=2)", "pytest-randomly (>=1)", "pytest-timeout (>=1)", "pytest-xdist (>=1.31.0)", "packaging (>=20.0)", "xonsh (>=0.9.16)"] 586 | 587 | [[package]] 588 | name = "wrapt" 589 | version = "1.12.1" 590 | description = "Module for decorators, wrappers and monkey patching." 591 | category = "dev" 592 | optional = false 593 | python-versions = "*" 594 | 595 | [[package]] 596 | name = "zipp" 597 | version = "3.4.0" 598 | description = "Backport of pathlib-compatible object wrapper for zip files" 599 | category = "dev" 600 | optional = false 601 | python-versions = ">=3.6" 602 | 603 | [package.extras] 604 | docs = ["sphinx", "jaraco.packaging (>=3.2)", "rst.linker (>=1.9)"] 605 | testing = ["pytest (>=3.5,!=3.7.3)", "pytest-checkdocs (>=1.2.3)", "pytest-flake8", "pytest-cov", "jaraco.test (>=3.2.0)", "jaraco.itertools", "func-timeout", "pytest-black (>=0.3.7)", "pytest-mypy"] 606 | 607 | [metadata] 608 | lock-version = "1.1" 609 | python-versions = ">=3.6.1,<4.0" 610 | content-hash = "85d9ac70f8e8d3214215cf9bed0fda276d4aa71aee72e97d3bd946830376315a" 611 | 612 | [metadata.files] 613 | appdirs = [ 614 | {file = "appdirs-1.4.4-py2.py3-none-any.whl", hash = "sha256:a841dacd6b99318a741b166adb07e19ee71a274450e68237b4650ca1055ab128"}, 615 | {file = "appdirs-1.4.4.tar.gz", hash = "sha256:7d5d0167b2b1ba821647616af46a749d1c653740dd0d2415100fe26e27afdf41"}, 616 | ] 617 | astroid = [ 618 | {file = "astroid-2.6.5-py3-none-any.whl", hash = "sha256:7b963d1c590d490f60d2973e57437115978d3a2529843f160b5003b721e1e925"}, 619 | {file = "astroid-2.6.5.tar.gz", hash = "sha256:83e494b02d75d07d4e347b27c066fd791c0c74fc96c613d1ea3de0c82c48168f"}, 620 | ] 621 | atomicwrites = [ 622 | {file = "atomicwrites-1.4.0-py2.py3-none-any.whl", hash = "sha256:6d1784dea7c0c8d4a5172b6c620f40b6e4cbfdf96d783691f2e1302a7b88e197"}, 623 | {file = "atomicwrites-1.4.0.tar.gz", hash = "sha256:ae70396ad1a434f9c7046fd2dd196fc04b12f9e91ffb859164193be8b6168a7a"}, 624 | ] 625 | attrs = [ 626 | {file = "attrs-20.3.0-py2.py3-none-any.whl", hash = "sha256:31b2eced602aa8423c2aea9c76a724617ed67cf9513173fd3a4f03e3a929c7e6"}, 627 | {file = "attrs-20.3.0.tar.gz", hash = "sha256:832aa3cde19744e49938b91fea06d69ecb9e649c93ba974535d08ad92164f700"}, 628 | ] 629 | black = [ 630 | {file = "black-20.8b1.tar.gz", hash = "sha256:1c02557aa099101b9d21496f8a914e9ed2222ef70336404eeeac8edba836fbea"}, 631 | ] 632 | certifi = [ 633 | {file = "certifi-2020.12.5-py2.py3-none-any.whl", hash = "sha256:719a74fb9e33b9bd44cc7f3a8d94bc35e4049deebe19ba7d8e108280cfd59830"}, 634 | {file = "certifi-2020.12.5.tar.gz", hash = "sha256:1a4995114262bffbc2413b159f2a1a480c969de6e6eb13ee966d470af86af59c"}, 635 | ] 636 | cfgv = [ 637 | {file = "cfgv-3.0.0-py2.py3-none-any.whl", hash = "sha256:f22b426ed59cd2ab2b54ff96608d846c33dfb8766a67f0b4a6ce130ce244414f"}, 638 | {file = "cfgv-3.0.0.tar.gz", hash = "sha256:04b093b14ddf9fd4d17c53ebfd55582d27b76ed30050193c14e560770c5360eb"}, 639 | ] 640 | chardet = [ 641 | {file = "chardet-3.0.4-py2.py3-none-any.whl", hash = "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"}, 642 | {file = "chardet-3.0.4.tar.gz", hash = "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae"}, 643 | ] 644 | click = [ 645 | {file = "click-7.1.2-py2.py3-none-any.whl", hash = "sha256:dacca89f4bfadd5de3d7489b7c8a566eee0d3676333fbb50030263894c38c0dc"}, 646 | {file = "click-7.1.2.tar.gz", hash = "sha256:d2b5255c7c6349bc1bd1e59e08cd12acbbd63ce649f2588755783aa94dfb6b1a"}, 647 | ] 648 | colorama = [ 649 | {file = "colorama-0.4.4-py2.py3-none-any.whl", hash = "sha256:9f47eda37229f68eee03b24b9748937c7dc3868f906e8ba69fbcbdd3bc5dc3e2"}, 650 | {file = "colorama-0.4.4.tar.gz", hash = "sha256:5941b2b48a20143d2267e95b1c2a7603ce057ee39fd88e7329b0c292aa16869b"}, 651 | ] 652 | coverage = [ 653 | {file = "coverage-5.5-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:b6d534e4b2ab35c9f93f46229363e17f63c53ad01330df9f2d6bd1187e5eaacf"}, 654 | {file = "coverage-5.5-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:b7895207b4c843c76a25ab8c1e866261bcfe27bfaa20c192de5190121770672b"}, 655 | {file = "coverage-5.5-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:c2723d347ab06e7ddad1a58b2a821218239249a9e4365eaff6649d31180c1669"}, 656 | {file = "coverage-5.5-cp27-cp27m-manylinux2010_i686.whl", hash = "sha256:900fbf7759501bc7807fd6638c947d7a831fc9fdf742dc10f02956ff7220fa90"}, 657 | {file = "coverage-5.5-cp27-cp27m-manylinux2010_x86_64.whl", hash = "sha256:004d1880bed2d97151facef49f08e255a20ceb6f9432df75f4eef018fdd5a78c"}, 658 | {file = "coverage-5.5-cp27-cp27m-win32.whl", hash = "sha256:06191eb60f8d8a5bc046f3799f8a07a2d7aefb9504b0209aff0b47298333302a"}, 659 | {file = "coverage-5.5-cp27-cp27m-win_amd64.whl", hash = "sha256:7501140f755b725495941b43347ba8a2777407fc7f250d4f5a7d2a1050ba8e82"}, 660 | {file = "coverage-5.5-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:372da284cfd642d8e08ef606917846fa2ee350f64994bebfbd3afb0040436905"}, 661 | {file = "coverage-5.5-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:8963a499849a1fc54b35b1c9f162f4108017b2e6db2c46c1bed93a72262ed083"}, 662 | {file = "coverage-5.5-cp27-cp27mu-manylinux2010_i686.whl", hash = "sha256:869a64f53488f40fa5b5b9dcb9e9b2962a66a87dab37790f3fcfb5144b996ef5"}, 663 | {file = "coverage-5.5-cp27-cp27mu-manylinux2010_x86_64.whl", hash = "sha256:4a7697d8cb0f27399b0e393c0b90f0f1e40c82023ea4d45d22bce7032a5d7b81"}, 664 | {file = "coverage-5.5-cp310-cp310-macosx_10_14_x86_64.whl", hash = "sha256:8d0a0725ad7c1a0bcd8d1b437e191107d457e2ec1084b9f190630a4fb1af78e6"}, 665 | {file = "coverage-5.5-cp310-cp310-manylinux1_x86_64.whl", hash = "sha256:51cb9476a3987c8967ebab3f0fe144819781fca264f57f89760037a2ea191cb0"}, 666 | {file = "coverage-5.5-cp310-cp310-win_amd64.whl", hash = "sha256:c0891a6a97b09c1f3e073a890514d5012eb256845c451bd48f7968ef939bf4ae"}, 667 | {file = "coverage-5.5-cp35-cp35m-macosx_10_9_x86_64.whl", hash = "sha256:3487286bc29a5aa4b93a072e9592f22254291ce96a9fbc5251f566b6b7343cdb"}, 668 | {file = "coverage-5.5-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:deee1077aae10d8fa88cb02c845cfba9b62c55e1183f52f6ae6a2df6a2187160"}, 669 | {file = "coverage-5.5-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:f11642dddbb0253cc8853254301b51390ba0081750a8ac03f20ea8103f0c56b6"}, 670 | {file = "coverage-5.5-cp35-cp35m-manylinux2010_i686.whl", hash = "sha256:6c90e11318f0d3c436a42409f2749ee1a115cd8b067d7f14c148f1ce5574d701"}, 671 | {file = "coverage-5.5-cp35-cp35m-manylinux2010_x86_64.whl", hash = "sha256:30c77c1dc9f253283e34c27935fded5015f7d1abe83bc7821680ac444eaf7793"}, 672 | {file = "coverage-5.5-cp35-cp35m-win32.whl", hash = "sha256:9a1ef3b66e38ef8618ce5fdc7bea3d9f45f3624e2a66295eea5e57966c85909e"}, 673 | {file = "coverage-5.5-cp35-cp35m-win_amd64.whl", hash = "sha256:972c85d205b51e30e59525694670de6a8a89691186012535f9d7dbaa230e42c3"}, 674 | {file = "coverage-5.5-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:af0e781009aaf59e25c5a678122391cb0f345ac0ec272c7961dc5455e1c40066"}, 675 | {file = "coverage-5.5-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:74d881fc777ebb11c63736622b60cb9e4aee5cace591ce274fb69e582a12a61a"}, 676 | {file = "coverage-5.5-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:92b017ce34b68a7d67bd6d117e6d443a9bf63a2ecf8567bb3d8c6c7bc5014465"}, 677 | {file = "coverage-5.5-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:d636598c8305e1f90b439dbf4f66437de4a5e3c31fdf47ad29542478c8508bbb"}, 678 | {file = "coverage-5.5-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:41179b8a845742d1eb60449bdb2992196e211341818565abded11cfa90efb821"}, 679 | {file = "coverage-5.5-cp36-cp36m-win32.whl", hash = "sha256:040af6c32813fa3eae5305d53f18875bedd079960822ef8ec067a66dd8afcd45"}, 680 | {file = "coverage-5.5-cp36-cp36m-win_amd64.whl", hash = "sha256:5fec2d43a2cc6965edc0bb9e83e1e4b557f76f843a77a2496cbe719583ce8184"}, 681 | {file = "coverage-5.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:18ba8bbede96a2c3dde7b868de9dcbd55670690af0988713f0603f037848418a"}, 682 | {file = "coverage-5.5-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:2910f4d36a6a9b4214bb7038d537f015346f413a975d57ca6b43bf23d6563b53"}, 683 | {file = "coverage-5.5-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:f0b278ce10936db1a37e6954e15a3730bea96a0997c26d7fee88e6c396c2086d"}, 684 | {file = "coverage-5.5-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:796c9c3c79747146ebd278dbe1e5c5c05dd6b10cc3bcb8389dfdf844f3ead638"}, 685 | {file = "coverage-5.5-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:53194af30d5bad77fcba80e23a1441c71abfb3e01192034f8246e0d8f99528f3"}, 686 | {file = "coverage-5.5-cp37-cp37m-win32.whl", hash = "sha256:184a47bbe0aa6400ed2d41d8e9ed868b8205046518c52464fde713ea06e3a74a"}, 687 | {file = "coverage-5.5-cp37-cp37m-win_amd64.whl", hash = "sha256:2949cad1c5208b8298d5686d5a85b66aae46d73eec2c3e08c817dd3513e5848a"}, 688 | {file = "coverage-5.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:217658ec7187497e3f3ebd901afdca1af062b42cfe3e0dafea4cced3983739f6"}, 689 | {file = "coverage-5.5-cp38-cp38-manylinux1_i686.whl", hash = "sha256:1aa846f56c3d49205c952d8318e76ccc2ae23303351d9270ab220004c580cfe2"}, 690 | {file = "coverage-5.5-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:24d4a7de75446be83244eabbff746d66b9240ae020ced65d060815fac3423759"}, 691 | {file = "coverage-5.5-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:d1f8bf7b90ba55699b3a5e44930e93ff0189aa27186e96071fac7dd0d06a1873"}, 692 | {file = "coverage-5.5-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:970284a88b99673ccb2e4e334cfb38a10aab7cd44f7457564d11898a74b62d0a"}, 693 | {file = "coverage-5.5-cp38-cp38-win32.whl", hash = "sha256:01d84219b5cdbfc8122223b39a954820929497a1cb1422824bb86b07b74594b6"}, 694 | {file = "coverage-5.5-cp38-cp38-win_amd64.whl", hash = "sha256:2e0d881ad471768bf6e6c2bf905d183543f10098e3b3640fc029509530091502"}, 695 | {file = "coverage-5.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:d1f9ce122f83b2305592c11d64f181b87153fc2c2bbd3bb4a3dde8303cfb1a6b"}, 696 | {file = "coverage-5.5-cp39-cp39-manylinux1_i686.whl", hash = "sha256:13c4ee887eca0f4c5a247b75398d4114c37882658300e153113dafb1d76de529"}, 697 | {file = "coverage-5.5-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:52596d3d0e8bdf3af43db3e9ba8dcdaac724ba7b5ca3f6358529d56f7a166f8b"}, 698 | {file = "coverage-5.5-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:2cafbbb3af0733db200c9b5f798d18953b1a304d3f86a938367de1567f4b5bff"}, 699 | {file = "coverage-5.5-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:44d654437b8ddd9eee7d1eaee28b7219bec228520ff809af170488fd2fed3e2b"}, 700 | {file = "coverage-5.5-cp39-cp39-win32.whl", hash = "sha256:d314ed732c25d29775e84a960c3c60808b682c08d86602ec2c3008e1202e3bb6"}, 701 | {file = "coverage-5.5-cp39-cp39-win_amd64.whl", hash = "sha256:13034c4409db851670bc9acd836243aeee299949bd5673e11844befcb0149f03"}, 702 | {file = "coverage-5.5-pp36-none-any.whl", hash = "sha256:f030f8873312a16414c0d8e1a1ddff2d3235655a2174e3648b4fa66b3f2f1079"}, 703 | {file = "coverage-5.5-pp37-none-any.whl", hash = "sha256:2a3859cb82dcbda1cfd3e6f71c27081d18aa251d20a17d87d26d4cd216fb0af4"}, 704 | {file = "coverage-5.5.tar.gz", hash = "sha256:ebe78fe9a0e874362175b02371bdfbee64d8edc42a044253ddf4ee7d3c15212c"}, 705 | ] 706 | dataclasses = [ 707 | {file = "dataclasses-0.8-py3-none-any.whl", hash = "sha256:0201d89fa866f68c8ebd9d08ee6ff50c0b255f8ec63a71c16fda7af82bb887bf"}, 708 | {file = "dataclasses-0.8.tar.gz", hash = "sha256:8479067f342acf957dc82ec415d355ab5edb7e7646b90dc6e2fd1d96ad084c97"}, 709 | ] 710 | distlib = [ 711 | {file = "distlib-0.3.1-py2.py3-none-any.whl", hash = "sha256:8c09de2c67b3e7deef7184574fc060ab8a793e7adbb183d942c389c8b13c52fb"}, 712 | {file = "distlib-0.3.1.zip", hash = "sha256:edf6116872c863e1aa9d5bb7cb5e05a022c519a4594dc703843343a9ddd9bff1"}, 713 | ] 714 | filelock = [ 715 | {file = "filelock-3.0.12-py3-none-any.whl", hash = "sha256:929b7d63ec5b7d6b71b0fa5ac14e030b3f70b75747cef1b10da9b879fef15836"}, 716 | {file = "filelock-3.0.12.tar.gz", hash = "sha256:18d82244ee114f543149c66a6e0c14e9c4f8a1044b5cdaadd0f82159d6a6ff59"}, 717 | ] 718 | flake8 = [ 719 | {file = "flake8-3.9.2-py2.py3-none-any.whl", hash = "sha256:bf8fd333346d844f616e8d47905ef3a3384edae6b4e9beb0c5101e25e3110907"}, 720 | {file = "flake8-3.9.2.tar.gz", hash = "sha256:07528381786f2a6237b061f6e96610a4167b226cb926e2aa2b6b1d78057c576b"}, 721 | ] 722 | httpretty = [ 723 | {file = "httpretty-1.1.4.tar.gz", hash = "sha256:20de0e5dd5a18292d36d928cc3d6e52f8b2ac73daec40d41eb62dee154933b68"}, 724 | ] 725 | identify = [ 726 | {file = "identify-1.5.10-py2.py3-none-any.whl", hash = "sha256:cc86e6a9a390879dcc2976cef169dd9cc48843ed70b7380f321d1b118163c60e"}, 727 | {file = "identify-1.5.10.tar.gz", hash = "sha256:943cd299ac7f5715fcb3f684e2fc1594c1e0f22a90d15398e5888143bd4144b5"}, 728 | ] 729 | idna = [ 730 | {file = "idna-2.10-py2.py3-none-any.whl", hash = "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"}, 731 | {file = "idna-2.10.tar.gz", hash = "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6"}, 732 | ] 733 | importlib-metadata = [ 734 | {file = "importlib_metadata-2.1.1-py2.py3-none-any.whl", hash = "sha256:c2d6341ff566f609e89a2acb2db190e5e1d23d5409d6cc8d2fe34d72443876d4"}, 735 | {file = "importlib_metadata-2.1.1.tar.gz", hash = "sha256:b8de9eff2b35fb037368f28a7df1df4e6436f578fa74423505b6c6a778d5b5dd"}, 736 | ] 737 | importlib-resources = [ 738 | {file = "importlib_resources-3.3.0-py2.py3-none-any.whl", hash = "sha256:a3d34a8464ce1d5d7c92b0ea4e921e696d86f2aa212e684451cb1482c8d84ed5"}, 739 | {file = "importlib_resources-3.3.0.tar.gz", hash = "sha256:7b51f0106c8ec564b1bef3d9c588bc694ce2b92125bbb6278f4f2f5b54ec3592"}, 740 | ] 741 | iniconfig = [ 742 | {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, 743 | {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, 744 | ] 745 | isort = [ 746 | {file = "isort-5.9.3-py3-none-any.whl", hash = "sha256:e17d6e2b81095c9db0a03a8025a957f334d6ea30b26f9ec70805411e5c7c81f2"}, 747 | {file = "isort-5.9.3.tar.gz", hash = "sha256:9c2ea1e62d871267b78307fe511c0838ba0da28698c5732d54e2790bf3ba9899"}, 748 | ] 749 | lazy-object-proxy = [ 750 | {file = "lazy-object-proxy-1.4.3.tar.gz", hash = "sha256:f3900e8a5de27447acbf900b4750b0ddfd7ec1ea7fbaf11dfa911141bc522af0"}, 751 | {file = "lazy_object_proxy-1.4.3-cp27-cp27m-macosx_10_13_x86_64.whl", hash = "sha256:a2238e9d1bb71a56cd710611a1614d1194dc10a175c1e08d75e1a7bcc250d442"}, 752 | {file = "lazy_object_proxy-1.4.3-cp27-cp27m-win32.whl", hash = "sha256:efa1909120ce98bbb3777e8b6f92237f5d5c8ea6758efea36a473e1d38f7d3e4"}, 753 | {file = "lazy_object_proxy-1.4.3-cp27-cp27m-win_amd64.whl", hash = "sha256:4677f594e474c91da97f489fea5b7daa17b5517190899cf213697e48d3902f5a"}, 754 | {file = "lazy_object_proxy-1.4.3-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:0c4b206227a8097f05c4dbdd323c50edf81f15db3b8dc064d08c62d37e1a504d"}, 755 | {file = "lazy_object_proxy-1.4.3-cp34-cp34m-manylinux1_x86_64.whl", hash = "sha256:d945239a5639b3ff35b70a88c5f2f491913eb94871780ebfabb2568bd58afc5a"}, 756 | {file = "lazy_object_proxy-1.4.3-cp34-cp34m-win32.whl", hash = "sha256:9651375199045a358eb6741df3e02a651e0330be090b3bc79f6d0de31a80ec3e"}, 757 | {file = "lazy_object_proxy-1.4.3-cp34-cp34m-win_amd64.whl", hash = "sha256:eba7011090323c1dadf18b3b689845fd96a61ba0a1dfbd7f24b921398affc357"}, 758 | {file = "lazy_object_proxy-1.4.3-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:48dab84ebd4831077b150572aec802f303117c8cc5c871e182447281ebf3ac50"}, 759 | {file = "lazy_object_proxy-1.4.3-cp35-cp35m-win32.whl", hash = "sha256:ca0a928a3ddbc5725be2dd1cf895ec0a254798915fb3a36af0964a0a4149e3db"}, 760 | {file = "lazy_object_proxy-1.4.3-cp35-cp35m-win_amd64.whl", hash = "sha256:194d092e6f246b906e8f70884e620e459fc54db3259e60cf69a4d66c3fda3449"}, 761 | {file = "lazy_object_proxy-1.4.3-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:97bb5884f6f1cdce0099f86b907aa41c970c3c672ac8b9c8352789e103cf3156"}, 762 | {file = "lazy_object_proxy-1.4.3-cp36-cp36m-win32.whl", hash = "sha256:cb2c7c57005a6804ab66f106ceb8482da55f5314b7fcb06551db1edae4ad1531"}, 763 | {file = "lazy_object_proxy-1.4.3-cp36-cp36m-win_amd64.whl", hash = "sha256:8d859b89baf8ef7f8bc6b00aa20316483d67f0b1cbf422f5b4dc56701c8f2ffb"}, 764 | {file = "lazy_object_proxy-1.4.3-cp37-cp37m-macosx_10_13_x86_64.whl", hash = "sha256:1be7e4c9f96948003609aa6c974ae59830a6baecc5376c25c92d7d697e684c08"}, 765 | {file = "lazy_object_proxy-1.4.3-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:d74bb8693bf9cf75ac3b47a54d716bbb1a92648d5f781fc799347cfc95952383"}, 766 | {file = "lazy_object_proxy-1.4.3-cp37-cp37m-win32.whl", hash = "sha256:9b15f3f4c0f35727d3a0fba4b770b3c4ebbb1fa907dbcc046a1d2799f3edd142"}, 767 | {file = "lazy_object_proxy-1.4.3-cp37-cp37m-win_amd64.whl", hash = "sha256:9254f4358b9b541e3441b007a0ea0764b9d056afdeafc1a5569eee1cc6c1b9ea"}, 768 | {file = "lazy_object_proxy-1.4.3-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:a6ae12d08c0bf9909ce12385803a543bfe99b95fe01e752536a60af2b7797c62"}, 769 | {file = "lazy_object_proxy-1.4.3-cp38-cp38-win32.whl", hash = "sha256:5541cada25cd173702dbd99f8e22434105456314462326f06dba3e180f203dfd"}, 770 | {file = "lazy_object_proxy-1.4.3-cp38-cp38-win_amd64.whl", hash = "sha256:59f79fef100b09564bc2df42ea2d8d21a64fdcda64979c0fa3db7bdaabaf6239"}, 771 | ] 772 | mccabe = [ 773 | {file = "mccabe-0.6.1-py2.py3-none-any.whl", hash = "sha256:ab8a6258860da4b6677da4bd2fe5dc2c659cff31b3ee4f7f5d64e79735b80d42"}, 774 | {file = "mccabe-0.6.1.tar.gz", hash = "sha256:dd8d182285a0fe56bace7f45b5e7d1a6ebcbf524e8f3bd87eb0f125271b8831f"}, 775 | ] 776 | mypy = [ 777 | {file = "mypy-0.812-cp35-cp35m-macosx_10_9_x86_64.whl", hash = "sha256:a26f8ec704e5a7423c8824d425086705e381b4f1dfdef6e3a1edab7ba174ec49"}, 778 | {file = "mypy-0.812-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:28fb5479c494b1bab244620685e2eb3c3f988d71fd5d64cc753195e8ed53df7c"}, 779 | {file = "mypy-0.812-cp35-cp35m-manylinux2010_x86_64.whl", hash = "sha256:9743c91088d396c1a5a3c9978354b61b0382b4e3c440ce83cf77994a43e8c521"}, 780 | {file = "mypy-0.812-cp35-cp35m-win_amd64.whl", hash = "sha256:d7da2e1d5f558c37d6e8c1246f1aec1e7349e4913d8fb3cb289a35de573fe2eb"}, 781 | {file = "mypy-0.812-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:4eec37370483331d13514c3f55f446fc5248d6373e7029a29ecb7b7494851e7a"}, 782 | {file = "mypy-0.812-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:d65cc1df038ef55a99e617431f0553cd77763869eebdf9042403e16089fe746c"}, 783 | {file = "mypy-0.812-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:61a3d5b97955422964be6b3baf05ff2ce7f26f52c85dd88db11d5e03e146a3a6"}, 784 | {file = "mypy-0.812-cp36-cp36m-win_amd64.whl", hash = "sha256:25adde9b862f8f9aac9d2d11971f226bd4c8fbaa89fb76bdadb267ef22d10064"}, 785 | {file = "mypy-0.812-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:552a815579aa1e995f39fd05dde6cd378e191b063f031f2acfe73ce9fb7f9e56"}, 786 | {file = "mypy-0.812-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:499c798053cdebcaa916eef8cd733e5584b5909f789de856b482cd7d069bdad8"}, 787 | {file = "mypy-0.812-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:5873888fff1c7cf5b71efbe80e0e73153fe9212fafdf8e44adfe4c20ec9f82d7"}, 788 | {file = "mypy-0.812-cp37-cp37m-win_amd64.whl", hash = "sha256:9f94aac67a2045ec719ffe6111df543bac7874cee01f41928f6969756e030564"}, 789 | {file = "mypy-0.812-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:d23e0ea196702d918b60c8288561e722bf437d82cb7ef2edcd98cfa38905d506"}, 790 | {file = "mypy-0.812-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:674e822aa665b9fd75130c6c5f5ed9564a38c6cea6a6432ce47eafb68ee578c5"}, 791 | {file = "mypy-0.812-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:abf7e0c3cf117c44d9285cc6128856106183938c68fd4944763003decdcfeb66"}, 792 | {file = "mypy-0.812-cp38-cp38-win_amd64.whl", hash = "sha256:0d0a87c0e7e3a9becdfbe936c981d32e5ee0ccda3e0f07e1ef2c3d1a817cf73e"}, 793 | {file = "mypy-0.812-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:7ce3175801d0ae5fdfa79b4f0cfed08807af4d075b402b7e294e6aa72af9aa2a"}, 794 | {file = "mypy-0.812-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:b09669bcda124e83708f34a94606e01b614fa71931d356c1f1a5297ba11f110a"}, 795 | {file = "mypy-0.812-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:33f159443db0829d16f0a8d83d94df3109bb6dd801975fe86bacb9bf71628e97"}, 796 | {file = "mypy-0.812-cp39-cp39-win_amd64.whl", hash = "sha256:3f2aca7f68580dc2508289c729bd49ee929a436208d2b2b6aab15745a70a57df"}, 797 | {file = "mypy-0.812-py3-none-any.whl", hash = "sha256:2f9b3407c58347a452fc0736861593e105139b905cca7d097e413453a1d650b4"}, 798 | {file = "mypy-0.812.tar.gz", hash = "sha256:cd07039aa5df222037005b08fbbfd69b3ab0b0bd7a07d7906de75ae52c4e3119"}, 799 | ] 800 | mypy-extensions = [ 801 | {file = "mypy_extensions-0.4.3-py2.py3-none-any.whl", hash = "sha256:090fedd75945a69ae91ce1303b5824f428daf5a028d2f6ab8a299250a846f15d"}, 802 | {file = "mypy_extensions-0.4.3.tar.gz", hash = "sha256:2d82818f5bb3e369420cb3c4060a7970edba416647068eb4c5343488a6c604a8"}, 803 | ] 804 | nodeenv = [ 805 | {file = "nodeenv-1.5.0-py2.py3-none-any.whl", hash = "sha256:5304d424c529c997bc888453aeaa6362d242b6b4631e90f3d4bf1b290f1c84a9"}, 806 | {file = "nodeenv-1.5.0.tar.gz", hash = "sha256:ab45090ae383b716c4ef89e690c41ff8c2b257b85b309f01f3654df3d084bd7c"}, 807 | ] 808 | oauthlib = [ 809 | {file = "oauthlib-3.1.0-py2.py3-none-any.whl", hash = "sha256:df884cd6cbe20e32633f1db1072e9356f53638e4361bef4e8b03c9127c9328ea"}, 810 | {file = "oauthlib-3.1.0.tar.gz", hash = "sha256:bee41cc35fcca6e988463cacc3bcb8a96224f470ca547e697b604cc697b2f889"}, 811 | ] 812 | packaging = [ 813 | {file = "packaging-20.7-py2.py3-none-any.whl", hash = "sha256:eb41423378682dadb7166144a4926e443093863024de508ca5c9737d6bc08376"}, 814 | {file = "packaging-20.7.tar.gz", hash = "sha256:05af3bb85d320377db281cf254ab050e1a7ebcbf5410685a9a407e18a1f81236"}, 815 | ] 816 | pathspec = [ 817 | {file = "pathspec-0.8.1-py2.py3-none-any.whl", hash = "sha256:aa0cb481c4041bf52ffa7b0d8fa6cd3e88a2ca4879c533c9153882ee2556790d"}, 818 | {file = "pathspec-0.8.1.tar.gz", hash = "sha256:86379d6b86d75816baba717e64b1a3a3469deb93bb76d613c9ce79edc5cb68fd"}, 819 | ] 820 | pluggy = [ 821 | {file = "pluggy-0.13.1-py2.py3-none-any.whl", hash = "sha256:966c145cd83c96502c3c3868f50408687b38434af77734af1e9ca461a4081d2d"}, 822 | {file = "pluggy-0.13.1.tar.gz", hash = "sha256:15b2acde666561e1298d71b523007ed7364de07029219b604cf808bfa1c765b0"}, 823 | ] 824 | pre-commit = [ 825 | {file = "pre_commit-2.14.0-py2.py3-none-any.whl", hash = "sha256:ec3045ae62e1aa2eecfb8e86fa3025c2e3698f77394ef8d2011ce0aedd85b2d4"}, 826 | {file = "pre_commit-2.14.0.tar.gz", hash = "sha256:2386eeb4cf6633712c7cc9ede83684d53c8cafca6b59f79c738098b51c6d206c"}, 827 | ] 828 | py = [ 829 | {file = "py-1.9.0-py2.py3-none-any.whl", hash = "sha256:366389d1db726cd2fcfc79732e75410e5fe4d31db13692115529d34069a043c2"}, 830 | {file = "py-1.9.0.tar.gz", hash = "sha256:9ca6883ce56b4e8da7e79ac18787889fa5206c79dcc67fb065376cd2fe03f342"}, 831 | ] 832 | pycodestyle = [ 833 | {file = "pycodestyle-2.7.0-py2.py3-none-any.whl", hash = "sha256:514f76d918fcc0b55c6680472f0a37970994e07bbb80725808c17089be302068"}, 834 | {file = "pycodestyle-2.7.0.tar.gz", hash = "sha256:c389c1d06bf7904078ca03399a4816f974a1d590090fecea0c63ec26ebaf1cef"}, 835 | ] 836 | pyflakes = [ 837 | {file = "pyflakes-2.3.0-py2.py3-none-any.whl", hash = "sha256:910208209dcea632721cb58363d0f72913d9e8cf64dc6f8ae2e02a3609aba40d"}, 838 | {file = "pyflakes-2.3.0.tar.gz", hash = "sha256:e59fd8e750e588358f1b8885e5a4751203a0516e0ee6d34811089ac294c8806f"}, 839 | ] 840 | pylint = [ 841 | {file = "pylint-2.9.6-py3-none-any.whl", hash = "sha256:2e1a0eb2e8ab41d6b5dbada87f066492bb1557b12b76c47c2ee8aa8a11186594"}, 842 | {file = "pylint-2.9.6.tar.gz", hash = "sha256:8b838c8983ee1904b2de66cce9d0b96649a91901350e956d78f289c3bc87b48e"}, 843 | ] 844 | pyparsing = [ 845 | {file = "pyparsing-2.4.7-py2.py3-none-any.whl", hash = "sha256:ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b"}, 846 | {file = "pyparsing-2.4.7.tar.gz", hash = "sha256:c203ec8783bf771a155b207279b9bccb8dea02d8f0c9e5f8ead507bc3246ecc1"}, 847 | ] 848 | pytest = [ 849 | {file = "pytest-6.2.4-py3-none-any.whl", hash = "sha256:91ef2131a9bd6be8f76f1f08eac5c5317221d6ad1e143ae03894b862e8976890"}, 850 | {file = "pytest-6.2.4.tar.gz", hash = "sha256:50bcad0a0b9c5a72c8e4e7c9855a3ad496ca6a881a3641b4260605450772c54b"}, 851 | ] 852 | pytest-cov = [ 853 | {file = "pytest-cov-2.12.1.tar.gz", hash = "sha256:261ceeb8c227b726249b376b8526b600f38667ee314f910353fa318caa01f4d7"}, 854 | {file = "pytest_cov-2.12.1-py2.py3-none-any.whl", hash = "sha256:261bb9e47e65bd099c89c3edf92972865210c36813f80ede5277dceb77a4a62a"}, 855 | ] 856 | pyupgrade = [ 857 | {file = "pyupgrade-2.23.0-py2.py3-none-any.whl", hash = "sha256:24535b6c3efc86b0a72b1cac627a852ad394a514823cd9e96c3442364e96e152"}, 858 | {file = "pyupgrade-2.23.0.tar.gz", hash = "sha256:c22beaf4d4fe5d1cd3b57028ee3de7393e537eeb41a9ba70d2cc531db9fdc244"}, 859 | ] 860 | pyyaml = [ 861 | {file = "PyYAML-5.3.1-cp27-cp27m-win32.whl", hash = "sha256:74809a57b329d6cc0fdccee6318f44b9b8649961fa73144a98735b0aaf029f1f"}, 862 | {file = "PyYAML-5.3.1-cp27-cp27m-win_amd64.whl", hash = "sha256:240097ff019d7c70a4922b6869d8a86407758333f02203e0fc6ff79c5dcede76"}, 863 | {file = "PyYAML-5.3.1-cp35-cp35m-win32.whl", hash = "sha256:4f4b913ca1a7319b33cfb1369e91e50354d6f07a135f3b901aca02aa95940bd2"}, 864 | {file = "PyYAML-5.3.1-cp35-cp35m-win_amd64.whl", hash = "sha256:cc8955cfbfc7a115fa81d85284ee61147059a753344bc51098f3ccd69b0d7e0c"}, 865 | {file = "PyYAML-5.3.1-cp36-cp36m-win32.whl", hash = "sha256:7739fc0fa8205b3ee8808aea45e968bc90082c10aef6ea95e855e10abf4a37b2"}, 866 | {file = "PyYAML-5.3.1-cp36-cp36m-win_amd64.whl", hash = "sha256:69f00dca373f240f842b2931fb2c7e14ddbacd1397d57157a9b005a6a9942648"}, 867 | {file = "PyYAML-5.3.1-cp37-cp37m-win32.whl", hash = "sha256:d13155f591e6fcc1ec3b30685d50bf0711574e2c0dfffd7644babf8b5102ca1a"}, 868 | {file = "PyYAML-5.3.1-cp37-cp37m-win_amd64.whl", hash = "sha256:73f099454b799e05e5ab51423c7bcf361c58d3206fa7b0d555426b1f4d9a3eaf"}, 869 | {file = "PyYAML-5.3.1-cp38-cp38-win32.whl", hash = "sha256:06a0d7ba600ce0b2d2fe2e78453a470b5a6e000a985dd4a4e54e436cc36b0e97"}, 870 | {file = "PyYAML-5.3.1-cp38-cp38-win_amd64.whl", hash = "sha256:95f71d2af0ff4227885f7a6605c37fd53d3a106fcab511b8860ecca9fcf400ee"}, 871 | {file = "PyYAML-5.3.1-cp39-cp39-win32.whl", hash = "sha256:ad9c67312c84def58f3c04504727ca879cb0013b2517c85a9a253f0cb6380c0a"}, 872 | {file = "PyYAML-5.3.1-cp39-cp39-win_amd64.whl", hash = "sha256:6034f55dab5fea9e53f436aa68fa3ace2634918e8b5994d82f3621c04ff5ed2e"}, 873 | {file = "PyYAML-5.3.1.tar.gz", hash = "sha256:b8eac752c5e14d3eca0e6dd9199cd627518cb5ec06add0de9d32baeee6fe645d"}, 874 | ] 875 | regex = [ 876 | {file = "regex-2020.11.13-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:8b882a78c320478b12ff024e81dc7d43c1462aa4a3341c754ee65d857a521f85"}, 877 | {file = "regex-2020.11.13-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:a63f1a07932c9686d2d416fb295ec2c01ab246e89b4d58e5fa468089cab44b70"}, 878 | {file = "regex-2020.11.13-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:6e4b08c6f8daca7d8f07c8d24e4331ae7953333dbd09c648ed6ebd24db5a10ee"}, 879 | {file = "regex-2020.11.13-cp36-cp36m-manylinux2010_i686.whl", hash = "sha256:bba349276b126947b014e50ab3316c027cac1495992f10e5682dc677b3dfa0c5"}, 880 | {file = "regex-2020.11.13-cp36-cp36m-manylinux2010_x86_64.whl", hash = "sha256:56e01daca75eae420bce184edd8bb341c8eebb19dd3bce7266332258f9fb9dd7"}, 881 | {file = "regex-2020.11.13-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:6a8ce43923c518c24a2579fda49f093f1397dad5d18346211e46f134fc624e31"}, 882 | {file = "regex-2020.11.13-cp36-cp36m-manylinux2014_i686.whl", hash = "sha256:1ab79fcb02b930de09c76d024d279686ec5d532eb814fd0ed1e0051eb8bd2daa"}, 883 | {file = "regex-2020.11.13-cp36-cp36m-manylinux2014_x86_64.whl", hash = "sha256:9801c4c1d9ae6a70aeb2128e5b4b68c45d4f0af0d1535500884d644fa9b768c6"}, 884 | {file = "regex-2020.11.13-cp36-cp36m-win32.whl", hash = "sha256:49cae022fa13f09be91b2c880e58e14b6da5d10639ed45ca69b85faf039f7a4e"}, 885 | {file = "regex-2020.11.13-cp36-cp36m-win_amd64.whl", hash = "sha256:749078d1eb89484db5f34b4012092ad14b327944ee7f1c4f74d6279a6e4d1884"}, 886 | {file = "regex-2020.11.13-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:b2f4007bff007c96a173e24dcda236e5e83bde4358a557f9ccf5e014439eae4b"}, 887 | {file = "regex-2020.11.13-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:38c8fd190db64f513fe4e1baa59fed086ae71fa45083b6936b52d34df8f86a88"}, 888 | {file = "regex-2020.11.13-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:5862975b45d451b6db51c2e654990c1820523a5b07100fc6903e9c86575202a0"}, 889 | {file = "regex-2020.11.13-cp37-cp37m-manylinux2010_i686.whl", hash = "sha256:262c6825b309e6485ec2493ffc7e62a13cf13fb2a8b6d212f72bd53ad34118f1"}, 890 | {file = "regex-2020.11.13-cp37-cp37m-manylinux2010_x86_64.whl", hash = "sha256:bafb01b4688833e099d79e7efd23f99172f501a15c44f21ea2118681473fdba0"}, 891 | {file = "regex-2020.11.13-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:e32f5f3d1b1c663af7f9c4c1e72e6ffe9a78c03a31e149259f531e0fed826512"}, 892 | {file = "regex-2020.11.13-cp37-cp37m-manylinux2014_i686.whl", hash = "sha256:3bddc701bdd1efa0d5264d2649588cbfda549b2899dc8d50417e47a82e1387ba"}, 893 | {file = "regex-2020.11.13-cp37-cp37m-manylinux2014_x86_64.whl", hash = "sha256:02951b7dacb123d8ea6da44fe45ddd084aa6777d4b2454fa0da61d569c6fa538"}, 894 | {file = "regex-2020.11.13-cp37-cp37m-win32.whl", hash = "sha256:0d08e71e70c0237883d0bef12cad5145b84c3705e9c6a588b2a9c7080e5af2a4"}, 895 | {file = "regex-2020.11.13-cp37-cp37m-win_amd64.whl", hash = "sha256:1fa7ee9c2a0e30405e21031d07d7ba8617bc590d391adfc2b7f1e8b99f46f444"}, 896 | {file = "regex-2020.11.13-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:baf378ba6151f6e272824b86a774326f692bc2ef4cc5ce8d5bc76e38c813a55f"}, 897 | {file = "regex-2020.11.13-cp38-cp38-manylinux1_i686.whl", hash = "sha256:e3faaf10a0d1e8e23a9b51d1900b72e1635c2d5b0e1bea1c18022486a8e2e52d"}, 898 | {file = "regex-2020.11.13-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:2a11a3e90bd9901d70a5b31d7dd85114755a581a5da3fc996abfefa48aee78af"}, 899 | {file = "regex-2020.11.13-cp38-cp38-manylinux2010_i686.whl", hash = "sha256:d1ebb090a426db66dd80df8ca85adc4abfcbad8a7c2e9a5ec7513ede522e0a8f"}, 900 | {file = "regex-2020.11.13-cp38-cp38-manylinux2010_x86_64.whl", hash = "sha256:b2b1a5ddae3677d89b686e5c625fc5547c6e492bd755b520de5332773a8af06b"}, 901 | {file = "regex-2020.11.13-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:2c99e97d388cd0a8d30f7c514d67887d8021541b875baf09791a3baad48bb4f8"}, 902 | {file = "regex-2020.11.13-cp38-cp38-manylinux2014_i686.whl", hash = "sha256:c084582d4215593f2f1d28b65d2a2f3aceff8342aa85afd7be23a9cad74a0de5"}, 903 | {file = "regex-2020.11.13-cp38-cp38-manylinux2014_x86_64.whl", hash = "sha256:a3d748383762e56337c39ab35c6ed4deb88df5326f97a38946ddd19028ecce6b"}, 904 | {file = "regex-2020.11.13-cp38-cp38-win32.whl", hash = "sha256:7913bd25f4ab274ba37bc97ad0e21c31004224ccb02765ad984eef43e04acc6c"}, 905 | {file = "regex-2020.11.13-cp38-cp38-win_amd64.whl", hash = "sha256:6c54ce4b5d61a7129bad5c5dc279e222afd00e721bf92f9ef09e4fae28755683"}, 906 | {file = "regex-2020.11.13-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:1862a9d9194fae76a7aaf0150d5f2a8ec1da89e8b55890b1786b8f88a0f619dc"}, 907 | {file = "regex-2020.11.13-cp39-cp39-manylinux1_i686.whl", hash = "sha256:4902e6aa086cbb224241adbc2f06235927d5cdacffb2425c73e6570e8d862364"}, 908 | {file = "regex-2020.11.13-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:7a25fcbeae08f96a754b45bdc050e1fb94b95cab046bf56b016c25e9ab127b3e"}, 909 | {file = "regex-2020.11.13-cp39-cp39-manylinux2010_i686.whl", hash = "sha256:d2d8ce12b7c12c87e41123997ebaf1a5767a5be3ec545f64675388970f415e2e"}, 910 | {file = "regex-2020.11.13-cp39-cp39-manylinux2010_x86_64.whl", hash = "sha256:f7d29a6fc4760300f86ae329e3b6ca28ea9c20823df123a2ea8693e967b29917"}, 911 | {file = "regex-2020.11.13-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:717881211f46de3ab130b58ec0908267961fadc06e44f974466d1887f865bd5b"}, 912 | {file = "regex-2020.11.13-cp39-cp39-manylinux2014_i686.whl", hash = "sha256:3128e30d83f2e70b0bed9b2a34e92707d0877e460b402faca908c6667092ada9"}, 913 | {file = "regex-2020.11.13-cp39-cp39-manylinux2014_x86_64.whl", hash = "sha256:8f6a2229e8ad946e36815f2a03386bb8353d4bde368fdf8ca5f0cb97264d3b5c"}, 914 | {file = "regex-2020.11.13-cp39-cp39-win32.whl", hash = "sha256:f8f295db00ef5f8bae530fc39af0b40486ca6068733fb860b42115052206466f"}, 915 | {file = "regex-2020.11.13-cp39-cp39-win_amd64.whl", hash = "sha256:a15f64ae3a027b64496a71ab1f722355e570c3fac5ba2801cafce846bf5af01d"}, 916 | {file = "regex-2020.11.13.tar.gz", hash = "sha256:83d6b356e116ca119db8e7c6fc2983289d87b27b3fac238cfe5dca529d884562"}, 917 | ] 918 | requests = [ 919 | {file = "requests-2.25.0-py2.py3-none-any.whl", hash = "sha256:e786fa28d8c9154e6a4de5d46a1d921b8749f8b74e28bde23768e5e16eece998"}, 920 | {file = "requests-2.25.0.tar.gz", hash = "sha256:7f1a0b932f4a60a1a65caa4263921bb7d9ee911957e0ae4a23a6dd08185ad5f8"}, 921 | ] 922 | requests-oauthlib = [ 923 | {file = "requests-oauthlib-1.3.0.tar.gz", hash = "sha256:b4261601a71fd721a8bd6d7aa1cc1d6a8a93b4a9f5e96626f8e4d91e8beeaa6a"}, 924 | {file = "requests_oauthlib-1.3.0-py2.py3-none-any.whl", hash = "sha256:7f71572defaecd16372f9006f33c2ec8c077c3cfa6f5911a9a90202beb513f3d"}, 925 | {file = "requests_oauthlib-1.3.0-py3.7.egg", hash = "sha256:fa6c47b933f01060936d87ae9327fead68768b69c6c9ea2109c48be30f2d4dbc"}, 926 | ] 927 | six = [ 928 | {file = "six-1.15.0-py2.py3-none-any.whl", hash = "sha256:8b74bedcbbbaca38ff6d7491d76f2b06b3592611af620f8426e82dddb04a5ced"}, 929 | {file = "six-1.15.0.tar.gz", hash = "sha256:30639c035cdb23534cd4aa2dd52c3bf48f06e5f4a941509c8bafd8ce11080259"}, 930 | ] 931 | tokenize-rt = [ 932 | {file = "tokenize_rt-4.0.0-py2.py3-none-any.whl", hash = "sha256:c47d3bd00857c24edefccdd6dc99c19d4ceed77c5971a3e2fac007fb0c02e39d"}, 933 | {file = "tokenize_rt-4.0.0.tar.gz", hash = "sha256:07d5f88b6a953612159b160129bcf9425677c8d062b0cb83250968ba803e1c64"}, 934 | ] 935 | toml = [ 936 | {file = "toml-0.10.2-py2.py3-none-any.whl", hash = "sha256:806143ae5bfb6a3c6e736a764057db0e6a0e05e338b5630894a5f779cabb4f9b"}, 937 | {file = "toml-0.10.2.tar.gz", hash = "sha256:b3bda1d108d5dd99f4a20d24d9c348e91c4db7ab1b749200bded2f839ccbe68f"}, 938 | ] 939 | tox = [ 940 | {file = "tox-3.24.1-py2.py3-none-any.whl", hash = "sha256:60eda26fa47b7130e6fc1145620b1fd897963af521093c3685c3f63d1c394029"}, 941 | {file = "tox-3.24.1.tar.gz", hash = "sha256:9850daeb96d21b4abf049bc5f197426123039e383ebfed201764e9355fc5a880"}, 942 | ] 943 | typed-ast = [ 944 | {file = "typed_ast-1.4.1-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:73d785a950fc82dd2a25897d525d003f6378d1cb23ab305578394694202a58c3"}, 945 | {file = "typed_ast-1.4.1-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:aaee9905aee35ba5905cfb3c62f3e83b3bec7b39413f0a7f19be4e547ea01ebb"}, 946 | {file = "typed_ast-1.4.1-cp35-cp35m-win32.whl", hash = "sha256:0c2c07682d61a629b68433afb159376e24e5b2fd4641d35424e462169c0a7919"}, 947 | {file = "typed_ast-1.4.1-cp35-cp35m-win_amd64.whl", hash = "sha256:4083861b0aa07990b619bd7ddc365eb7fa4b817e99cf5f8d9cf21a42780f6e01"}, 948 | {file = "typed_ast-1.4.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:269151951236b0f9a6f04015a9004084a5ab0d5f19b57de779f908621e7d8b75"}, 949 | {file = "typed_ast-1.4.1-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:24995c843eb0ad11a4527b026b4dde3da70e1f2d8806c99b7b4a7cf491612652"}, 950 | {file = "typed_ast-1.4.1-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:fe460b922ec15dd205595c9b5b99e2f056fd98ae8f9f56b888e7a17dc2b757e7"}, 951 | {file = "typed_ast-1.4.1-cp36-cp36m-manylinux2014_aarch64.whl", hash = "sha256:fcf135e17cc74dbfbc05894ebca928ffeb23d9790b3167a674921db19082401f"}, 952 | {file = "typed_ast-1.4.1-cp36-cp36m-win32.whl", hash = "sha256:4e3e5da80ccbebfff202a67bf900d081906c358ccc3d5e3c8aea42fdfdfd51c1"}, 953 | {file = "typed_ast-1.4.1-cp36-cp36m-win_amd64.whl", hash = "sha256:249862707802d40f7f29f6e1aad8d84b5aa9e44552d2cc17384b209f091276aa"}, 954 | {file = "typed_ast-1.4.1-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8ce678dbaf790dbdb3eba24056d5364fb45944f33553dd5869b7580cdbb83614"}, 955 | {file = "typed_ast-1.4.1-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:c9e348e02e4d2b4a8b2eedb48210430658df6951fa484e59de33ff773fbd4b41"}, 956 | {file = "typed_ast-1.4.1-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:bcd3b13b56ea479b3650b82cabd6b5343a625b0ced5429e4ccad28a8973f301b"}, 957 | {file = "typed_ast-1.4.1-cp37-cp37m-manylinux2014_aarch64.whl", hash = "sha256:f208eb7aff048f6bea9586e61af041ddf7f9ade7caed625742af423f6bae3298"}, 958 | {file = "typed_ast-1.4.1-cp37-cp37m-win32.whl", hash = "sha256:d5d33e9e7af3b34a40dc05f498939f0ebf187f07c385fd58d591c533ad8562fe"}, 959 | {file = "typed_ast-1.4.1-cp37-cp37m-win_amd64.whl", hash = "sha256:0666aa36131496aed8f7be0410ff974562ab7eeac11ef351def9ea6fa28f6355"}, 960 | {file = "typed_ast-1.4.1-cp38-cp38-macosx_10_15_x86_64.whl", hash = "sha256:d205b1b46085271b4e15f670058ce182bd1199e56b317bf2ec004b6a44f911f6"}, 961 | {file = "typed_ast-1.4.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:6daac9731f172c2a22ade6ed0c00197ee7cc1221aa84cfdf9c31defeb059a907"}, 962 | {file = "typed_ast-1.4.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:498b0f36cc7054c1fead3d7fc59d2150f4d5c6c56ba7fb150c013fbc683a8d2d"}, 963 | {file = "typed_ast-1.4.1-cp38-cp38-manylinux2014_aarch64.whl", hash = "sha256:7e4c9d7658aaa1fc80018593abdf8598bf91325af6af5cce4ce7c73bc45ea53d"}, 964 | {file = "typed_ast-1.4.1-cp38-cp38-win32.whl", hash = "sha256:715ff2f2df46121071622063fc7543d9b1fd19ebfc4f5c8895af64a77a8c852c"}, 965 | {file = "typed_ast-1.4.1-cp38-cp38-win_amd64.whl", hash = "sha256:fc0fea399acb12edbf8a628ba8d2312f583bdbdb3335635db062fa98cf71fca4"}, 966 | {file = "typed_ast-1.4.1-cp39-cp39-macosx_10_15_x86_64.whl", hash = "sha256:d43943ef777f9a1c42bf4e552ba23ac77a6351de620aa9acf64ad54933ad4d34"}, 967 | {file = "typed_ast-1.4.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:92c325624e304ebf0e025d1224b77dd4e6393f18aab8d829b5b7e04afe9b7a2c"}, 968 | {file = "typed_ast-1.4.1-cp39-cp39-manylinux1_i686.whl", hash = "sha256:d648b8e3bf2fe648745c8ffcee3db3ff903d0817a01a12dd6a6ea7a8f4889072"}, 969 | {file = "typed_ast-1.4.1-cp39-cp39-manylinux1_x86_64.whl", hash = "sha256:fac11badff8313e23717f3dada86a15389d0708275bddf766cca67a84ead3e91"}, 970 | {file = "typed_ast-1.4.1-cp39-cp39-manylinux2014_aarch64.whl", hash = "sha256:0d8110d78a5736e16e26213114a38ca35cb15b6515d535413b090bd50951556d"}, 971 | {file = "typed_ast-1.4.1-cp39-cp39-win32.whl", hash = "sha256:b52ccf7cfe4ce2a1064b18594381bccf4179c2ecf7f513134ec2f993dd4ab395"}, 972 | {file = "typed_ast-1.4.1-cp39-cp39-win_amd64.whl", hash = "sha256:3742b32cf1c6ef124d57f95be609c473d7ec4c14d0090e5a5e05a15269fb4d0c"}, 973 | {file = "typed_ast-1.4.1.tar.gz", hash = "sha256:8c8aaad94455178e3187ab22c8b01a3837f8ee50e09cf31f1ba129eb293ec30b"}, 974 | ] 975 | typing-extensions = [ 976 | {file = "typing_extensions-3.7.4.3-py2-none-any.whl", hash = "sha256:dafc7639cde7f1b6e1acc0f457842a83e722ccca8eef5270af2d74792619a89f"}, 977 | {file = "typing_extensions-3.7.4.3-py3-none-any.whl", hash = "sha256:7cb407020f00f7bfc3cb3e7881628838e69d8f3fcab2f64742a5e76b2f841918"}, 978 | {file = "typing_extensions-3.7.4.3.tar.gz", hash = "sha256:99d4073b617d30288f569d3f13d2bd7548c3a7e4c8de87db09a9d29bb3a4a60c"}, 979 | ] 980 | urllib3 = [ 981 | {file = "urllib3-1.22-py2.py3-none-any.whl", hash = "sha256:06330f386d6e4b195fbfc736b297f58c5a892e4440e54d294d7004e3a9bbea1b"}, 982 | {file = "urllib3-1.22.tar.gz", hash = "sha256:cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f"}, 983 | ] 984 | virtualenv = [ 985 | {file = "virtualenv-20.2.1-py2.py3-none-any.whl", hash = "sha256:07cff122e9d343140366055f31be4dcd61fd598c69d11cd33a9d9c8df4546dd7"}, 986 | {file = "virtualenv-20.2.1.tar.gz", hash = "sha256:e0aac7525e880a429764cefd3aaaff54afb5d9f25c82627563603f5d7de5a6e5"}, 987 | ] 988 | wrapt = [ 989 | {file = "wrapt-1.12.1.tar.gz", hash = "sha256:b62ffa81fb85f4332a4f609cab4ac40709470da05643a082ec1eb88e6d9b97d7"}, 990 | ] 991 | zipp = [ 992 | {file = "zipp-3.4.0-py3-none-any.whl", hash = "sha256:102c24ef8f171fd729d46599845e95c7ab894a4cf45f5de11a44cc7444fb1108"}, 993 | {file = "zipp-3.4.0.tar.gz", hash = "sha256:ed5eee1974372595f9e416cc7bbeeb12335201d8081ca8a0743c954d4446e5cb"}, 994 | ] 995 | -------------------------------------------------------------------------------- /poetry.toml: -------------------------------------------------------------------------------- 1 | [virtualenvs] 2 | in-project = true 3 | -------------------------------------------------------------------------------- /pymfy/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tetienne/somfy-open-api/056e41ad11440b498417a4b71b8e883738435ba6/pymfy/__init__.py -------------------------------------------------------------------------------- /pymfy/api/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tetienne/somfy-open-api/056e41ad11440b498417a4b71b8e883738435ba6/pymfy/api/__init__.py -------------------------------------------------------------------------------- /pymfy/api/devices/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tetienne/somfy-open-api/056e41ad11440b498417a4b71b8e883738435ba6/pymfy/api/devices/__init__.py -------------------------------------------------------------------------------- /pymfy/api/devices/base.py: -------------------------------------------------------------------------------- 1 | from typing import Union 2 | 3 | from pymfy.api.model import Command, Device 4 | from pymfy.api.somfy_api import SomfyApi 5 | 6 | 7 | class SomfyDevice: 8 | __slots__ = "device", "api" 9 | 10 | def __init__(self, device: Device, api: SomfyApi): 11 | self.device = device 12 | self.api = api 13 | 14 | def refresh_state(self) -> None: 15 | self.device = self.api.get_device(self.device.id) 16 | 17 | def send_command(self, command: Command) -> None: 18 | if command.name in [capability.name for capability in self.device.capabilities]: 19 | self.api.send_command(self.device.id, command) 20 | else: 21 | message_template = ( 22 | "Command {} not available. " 23 | "Categories: {}, Type: {}, Capabilities: {}" 24 | ) 25 | message = message_template.format( 26 | command.name, 27 | self.device.categories, 28 | self.device.type, 29 | self.device.capabilities, 30 | ) 31 | raise UnsupportedCommandException(message) 32 | 33 | def get_state(self, state_name: str) -> Union[str, int, float]: 34 | return next( 35 | state.value for state in self.device.states if state.name == state_name 36 | ) 37 | 38 | 39 | class UnsupportedCommandException(Exception): 40 | """Raise a Command is not listed in the capabilities of a device.""" 41 | -------------------------------------------------------------------------------- /pymfy/api/devices/blind.py: -------------------------------------------------------------------------------- 1 | from typing import cast 2 | 3 | from pymfy.api.devices.roller_shutter import RollerShutter 4 | from pymfy.api.model import Command, Parameter 5 | 6 | 7 | class Blind(RollerShutter): 8 | """Class to represent a blind.""" 9 | 10 | @property 11 | def orientation(self) -> int: 12 | return cast(int, self.get_state("orientation")) 13 | 14 | @orientation.setter 15 | def orientation(self, value: int) -> None: 16 | command = Command("rotation", Parameter("orientation", value)) 17 | self.send_command(command) 18 | -------------------------------------------------------------------------------- /pymfy/api/devices/camera_protect.py: -------------------------------------------------------------------------------- 1 | from typing import cast 2 | 3 | from pymfy.api.devices.base import SomfyDevice 4 | from pymfy.api.model import Command 5 | 6 | 7 | class CameraProtect(SomfyDevice): 8 | """Class to represent a camera""" 9 | 10 | def close_shutter(self) -> None: 11 | self.send_command(Command("shutter_close")) 12 | 13 | def open_shutter(self) -> None: 14 | self.send_command(Command("shutter_open")) 15 | 16 | def get_shutter_position(self) -> str: 17 | """ Possible returned values are opened and closed """ 18 | return cast(str, self.get_state("shutter_position")) 19 | -------------------------------------------------------------------------------- /pymfy/api/devices/category.py: -------------------------------------------------------------------------------- 1 | from enum import Enum, unique 2 | 3 | 4 | @unique 5 | class Category(Enum): 6 | ROLLER_SHUTTER = "roller_shutter" 7 | HUB = "hub" 8 | INTERIOR_BLIND = "interior_blind" 9 | EXTERIOR_BLIND = "exterior_blind" 10 | CAMERA = "camera" 11 | HVAC = "hvac" 12 | -------------------------------------------------------------------------------- /pymfy/api/devices/roller_shutter.py: -------------------------------------------------------------------------------- 1 | from typing import Optional, cast 2 | 3 | from pymfy.api.devices.base import SomfyDevice 4 | from pymfy.api.model import Command, Parameter 5 | 6 | 7 | class RollerShutter(SomfyDevice): 8 | """Class to represent a roller shutter.""" 9 | 10 | def get_position(self) -> int: 11 | return cast(int, self.get_state("position")) 12 | 13 | def set_position(self, value: int, low_speed: Optional[bool] = False) -> None: 14 | command_name = "position_low_speed" if low_speed else "position" 15 | command = Command(command_name, Parameter("position", value)) 16 | self.send_command(command) 17 | 18 | def close(self, low_speed: Optional[bool] = False) -> None: 19 | if low_speed: 20 | self.set_position(100, True) 21 | else: 22 | self.send_command(Command("close")) 23 | 24 | def open(self, low_speed: Optional[bool] = False) -> None: 25 | if low_speed: 26 | self.set_position(0, True) 27 | else: 28 | self.send_command(Command("open")) 29 | 30 | def stop(self) -> None: 31 | self.send_command(Command("stop")) 32 | 33 | def identify(self) -> None: 34 | self.send_command(Command("identify")) 35 | 36 | def is_closed(self) -> bool: 37 | return self.get_position() == 100 38 | -------------------------------------------------------------------------------- /pymfy/api/devices/thermostat.py: -------------------------------------------------------------------------------- 1 | from datetime import datetime 2 | from enum import Enum 3 | from typing import Optional, cast 4 | 5 | from pymfy.api.devices.base import SomfyDevice 6 | from pymfy.api.model import Command, Parameter 7 | 8 | 9 | class TargetMode(Enum): 10 | AWAY = "away" 11 | AT_HOME = "at_home" 12 | FROST_PROTECTION = "freeze" 13 | MANUAL = "manuel" # Yes in French 14 | SLEEP = "sleep" 15 | GEOFENCING = "geofencing" 16 | 17 | 18 | class DurationType(Enum): 19 | FURTHER_NOTICE = "further_notice" 20 | NEXT_MODE = "next_mode" 21 | DATE = "date" 22 | 23 | 24 | class RegulationState(Enum): 25 | DEROGATION = "Derogation" 26 | TIMETABLE = "Timetable" 27 | 28 | 29 | class HvacState(Enum): 30 | HEAT = "he" 31 | COOL = "co" 32 | 33 | 34 | class Thermostat(SomfyDevice): 35 | """Class to represent a thermostat.""" 36 | 37 | def get_ambient_temperature(self) -> float: 38 | return cast(float, self.get_state("ambient_temperature")) 39 | 40 | def get_humidity(self) -> float: 41 | return cast(float, self.get_state("humidity")) 42 | 43 | def get_battery(self) -> int: 44 | return cast(int, self.get_state("battery")) 45 | 46 | def get_hvac_state(self) -> HvacState: 47 | hvac_state = self.get_state("hvac_state") 48 | return next(state for state in HvacState if state.value == hvac_state) 49 | 50 | def get_regulation_state(self) -> RegulationState: 51 | regulation_state = self.get_state("regulation_state") 52 | return next( 53 | state for state in RegulationState if state.value == regulation_state 54 | ) 55 | 56 | def get_target_mode(self) -> TargetMode: 57 | target_mode = self.get_state("target_mode") 58 | return next(state for state in TargetMode if state.value == target_mode) 59 | 60 | def get_target_temperature(self) -> int: 61 | return cast(int, self.get_state("target_temperature")) 62 | 63 | def get_target_end_date(self) -> Optional[datetime]: 64 | timestamp = self.get_state("target_end_date") 65 | if timestamp == -1: 66 | return None 67 | return datetime.utcfromtimestamp(cast(int, timestamp)) 68 | 69 | def get_target_start_date(self) -> Optional[datetime]: 70 | return datetime.utcfromtimestamp(cast(int, self.get_state("target_start_date"))) 71 | 72 | def get_at_home_temperature(self) -> int: 73 | return cast(int, self.get_state("at_home_temperature")) 74 | 75 | def get_away_temperature(self) -> int: 76 | return cast(int, self.get_state("away_temperature")) 77 | 78 | def get_night_temperature(self) -> int: 79 | return cast(int, self.get_state("night_temperature")) 80 | 81 | def get_frost_protection_temperature(self) -> int: 82 | return cast(int, self.get_state("frost_protection_temperature")) 83 | 84 | def set_target( 85 | self, 86 | target_mode: TargetMode, 87 | target_temperature: int, 88 | duration_type: DurationType, 89 | duration: Optional[int] = -1, 90 | ) -> None: 91 | parameters = [ 92 | Parameter("target_mode", target_mode.value), 93 | Parameter("target_temperature", target_temperature), 94 | Parameter("duration_type", duration_type.value), 95 | ] 96 | if duration: 97 | parameters.append(Parameter("duration", duration)) 98 | command = Command("set_target", parameters) 99 | self.send_command(command) 100 | 101 | def cancel_target(self) -> None: 102 | self.send_command(Command("cancel_target")) 103 | 104 | def set_at_home_temperature(self, temperature: int) -> None: 105 | if abs(temperature) > 999: 106 | raise ValueError("temperature must be between -999 and 999") 107 | parameter = Parameter("at_home_temperature", temperature) 108 | command = Command("set_at_home_temperature", parameter) 109 | self.send_command(command) 110 | 111 | def set_away_temperature(self, temperature: int) -> None: 112 | if abs(temperature) > 999: 113 | raise ValueError("temperature must be between -999 and 999") 114 | parameter = Parameter("away_temperature", temperature) 115 | command = Command("set_away_temperature", parameter) 116 | self.send_command(command) 117 | 118 | def set_night_temperature(self, temperature: int) -> None: 119 | if abs(temperature) > 999: 120 | raise ValueError("temperature must be between -999 and 999") 121 | parameter = Parameter("night_temperature", temperature) 122 | command = Command("set_night_temperature", parameter) 123 | self.send_command(command) 124 | 125 | def set_frost_protection_temperature(self, temperature: int) -> None: 126 | if abs(temperature) > 999: 127 | raise ValueError("temperature must be between -999 and 999") 128 | parameter = Parameter("frost_protection_temperature", temperature) 129 | command = Command("set_frost_protection_temperature", parameter) 130 | self.send_command(command) 131 | -------------------------------------------------------------------------------- /pymfy/api/error.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Dict 2 | 3 | 4 | class ServerException(Exception): 5 | def __init__(self, response: Dict[str, Any]) -> None: 6 | self.error_code = response["fault"]["detail"]["errorcode"] 7 | self.fault_string = response["fault"]["faultstring"] 8 | super().__init__() 9 | 10 | def __str__(self) -> str: 11 | return f"error_code: {self.error_code}, fault_string: {self.fault_string}" 12 | 13 | 14 | class InvalidAccessTokenException(ServerException): 15 | pass 16 | 17 | 18 | class QuotaViolationException(ServerException): 19 | pass 20 | 21 | 22 | class AccessTokenException(ServerException): 23 | pass 24 | 25 | 26 | class ClientException(Exception): 27 | def __init__(self, response: Dict[str, Any]) -> None: 28 | self.data = response["data"] 29 | self.message = response["message"] 30 | super().__init__() 31 | 32 | def __str__(self) -> str: 33 | return f"message: {self.message}, data: {self.data}" 34 | 35 | 36 | class ValidateException(ClientException): 37 | pass 38 | 39 | 40 | class DeviceNotFoundException(ClientException): 41 | pass 42 | 43 | 44 | class DefinitionNotFoundException(ClientException): 45 | pass 46 | 47 | 48 | class SiteNotFoundException(ClientException): 49 | pass 50 | 51 | 52 | class SetupNotFoundException(ClientException): 53 | pass 54 | 55 | 56 | SERVER_ERROR = { 57 | "oauth.v2.InvalidAccessToken": InvalidAccessTokenException, 58 | "keymanagement.service.access_token_expired": AccessTokenException, 59 | "policies.ratelimit.QuotaViolation": QuotaViolationException, 60 | } 61 | 62 | CLIENT_ERROR = { 63 | "ValidateError": ValidateException, 64 | "device_not_found": DeviceNotFoundException, 65 | "definition_not_found": DefinitionNotFoundException, 66 | "setup_not_found": SetupNotFoundException, 67 | "site_not_found": SiteNotFoundException, 68 | } 69 | -------------------------------------------------------------------------------- /pymfy/api/model.py: -------------------------------------------------------------------------------- 1 | from typing import Any, Dict, List, Optional, Union 2 | 3 | # pylint: disable=too-many-instance-attributes 4 | 5 | 6 | class Site: 7 | __slots__ = "id", "label" 8 | 9 | def __init__(self, id: str, label: str): 10 | self.id = id 11 | self.label = label 12 | 13 | 14 | class Device: 15 | __slots__ = ( 16 | "id", 17 | "name", 18 | "type", 19 | "site_id", 20 | "states", 21 | "capabilities", 22 | "categories", 23 | "parent_id", 24 | ) 25 | 26 | def __init__( 27 | self, 28 | *, 29 | id: str, 30 | type: str, 31 | site_id: str, 32 | categories: List[str], 33 | states: List[Dict[str, Any]], 34 | capabilities: List[Dict[str, Any]], 35 | parent_id: Optional[str] = None, 36 | name: Optional[str] = None, 37 | **_: Any 38 | ): 39 | self.id = id 40 | self.name = name 41 | self.type = type 42 | self.site_id = site_id 43 | self.categories = categories 44 | self.states = [State(**s) for s in states] 45 | self.capabilities = [Capability(**c) for c in capabilities] 46 | self.parent_id = parent_id 47 | 48 | 49 | class State: 50 | __slots__ = "name", "value", "type" 51 | 52 | def __init__(self, name: str, value: Union[str, int], type: str, **_: Any): 53 | self.name = name 54 | self.value = value 55 | self.type = type 56 | 57 | 58 | class Capability: 59 | __slots__ = "name", "parameters" 60 | 61 | def __init__(self, name: str, parameters: List[Dict[str, str]], **_: Any): 62 | self.name = name 63 | self.parameters = [ParameterDescription(**p) for p in parameters] 64 | 65 | 66 | class ParameterDescription: 67 | __slots__ = "name", "type", "condition" 68 | 69 | def __init__(self, name: str, type: str, condition: Optional[str] = None, **_: Any): 70 | self.name = name 71 | self.type = type 72 | self.condition = condition 73 | 74 | 75 | class Parameter(dict): # type: ignore 76 | __slots__ = "name", "value" 77 | 78 | def __init__(self, name: str, value: Union[str, int]): 79 | self.name = name 80 | self.value = value 81 | dict.__init__(self, name=name, value=value) 82 | 83 | 84 | class Command(dict): # type: ignore 85 | __slots__ = "name", "parameters" 86 | 87 | def __init__( 88 | self, name: str, parameters: Union[List[Parameter], Parameter, None] = None 89 | ): 90 | if parameters is None: 91 | parameters = [] 92 | if not isinstance(parameters, list): 93 | parameters = [parameters] 94 | self.name = name 95 | self.parameters = parameters 96 | dict.__init__(self, name=name, parameters=parameters) 97 | -------------------------------------------------------------------------------- /pymfy/api/somfy_api.py: -------------------------------------------------------------------------------- 1 | from json import JSONDecodeError 2 | from typing import Any, Callable, Dict, List, Optional, Tuple, Union 3 | 4 | from oauthlib.oauth2 import TokenExpiredError 5 | from requests import Response 6 | from requests_oauthlib import OAuth2Session 7 | 8 | from pymfy.api.devices.category import Category 9 | from pymfy.api.error import CLIENT_ERROR, SERVER_ERROR, ClientException, ServerException 10 | from pymfy.api.model import Command, Device, Site 11 | 12 | BASE_URL = "https://api.somfy.com/api/v1" 13 | 14 | SOMFY_OAUTH = "https://accounts.somfy.com/oauth/oauth/v2/auth" 15 | SOMFY_TOKEN = "https://accounts.somfy.com/oauth/oauth/v2/token" 16 | SOMFY_REFRESH = "https://accounts.somfy.com/oauth/oauth/v2/token" 17 | 18 | 19 | class SomfyApi: 20 | def __init__( 21 | self, 22 | client_id: str, 23 | client_secret: str, 24 | redirect_uri: Optional[str] = None, 25 | token: Optional[Dict[str, str]] = None, 26 | token_updater: Optional[Callable[[str], None]] = None, 27 | user_agent: Optional[str] = "pymfy", 28 | ): 29 | 30 | self.client_id = client_id 31 | self.client_secret = client_secret 32 | self.token_updater = token_updater 33 | 34 | extra = {"client_id": self.client_id, "client_secret": self.client_secret} 35 | 36 | self._oauth = OAuth2Session( 37 | client_id=client_id, 38 | token=token, 39 | redirect_uri=redirect_uri, 40 | auto_refresh_kwargs=extra, 41 | token_updater=token_updater, 42 | ) 43 | self._oauth.headers["User-Agent"] = user_agent 44 | 45 | def get_sites(self) -> List[Site]: 46 | response = self.get("/site") 47 | response.raise_for_status() 48 | return [Site(**s) for s in response.json()] 49 | 50 | def get_site(self, site_id: str) -> Site: 51 | response = self.get(f"/site/{site_id}") 52 | response.raise_for_status() 53 | return Site(**response.json()) 54 | 55 | def send_command(self, device_id: str, command: Union[Command, str]) -> str: 56 | if isinstance(command, str): 57 | command = Command(command) 58 | response = self.post(f"/device/{device_id}/exec", json=command) 59 | response.raise_for_status() 60 | return response.json().get("job_id") 61 | 62 | def get_devices( 63 | self, site_id: str, category: Optional[Category] = None 64 | ) -> List[Device]: 65 | response = self.get(f"/site/{site_id}/device") 66 | try: 67 | content = response.json() 68 | except JSONDecodeError: 69 | response.raise_for_status() 70 | 71 | devices = [ 72 | Device(**d) 73 | for d in content 74 | if category is None or category.value in Device(**d).categories 75 | ] 76 | return devices 77 | 78 | def get_device(self, device_id: str) -> Device: 79 | response = self.get(f"/device/{device_id}") 80 | response.raise_for_status() 81 | return Device(**response.json()) 82 | 83 | def get(self, path: str) -> Response: 84 | """Fetch a URL from the Somfy API.""" 85 | return self._request("get", path) 86 | 87 | def post(self, path: str, *, json: Dict[str, Any]) -> Response: 88 | """Post data to the Somfy API.""" 89 | return self._request("post", path, json=json) 90 | 91 | def get_authorization_url(self, state: Optional[str] = None) -> Tuple[str, str]: 92 | return self._oauth.authorization_url(SOMFY_OAUTH, state) 93 | 94 | def request_token( 95 | self, authorization_response: Optional[str] = None, code: Optional[str] = None 96 | ) -> Dict[str, str]: 97 | """Generic method for fetching a Somfy access token. 98 | 99 | :param authorization_response: Authorization response URL, the callback 100 | URL of the request back to you. 101 | :param code: Authorization code 102 | :return: A token dict 103 | """ 104 | return self._oauth.fetch_token( 105 | SOMFY_TOKEN, 106 | authorization_response=authorization_response, 107 | code=code, 108 | client_secret=self.client_secret, 109 | ) 110 | 111 | def refresh_tokens(self) -> Dict[str, Union[str, int]]: 112 | """Refresh and return new Somfy tokens.""" 113 | token = self._oauth.refresh_token(SOMFY_REFRESH) 114 | 115 | if self.token_updater is not None: 116 | self.token_updater(token) 117 | 118 | return token 119 | 120 | def _request(self, method: str, path: str, **kwargs: Any) -> Response: 121 | """Make a request. 122 | 123 | We don't use the built-in token refresh mechanism of OAuth2 session because 124 | we want to allow overriding the token refresh logic. 125 | """ 126 | url = f"{BASE_URL}{path}" 127 | try: 128 | response = getattr(self._oauth, method)(url, **kwargs) 129 | except TokenExpiredError: 130 | self._oauth.token = self.refresh_tokens() 131 | 132 | response = getattr(self._oauth, method)(url, **kwargs) 133 | 134 | self._check_response(response) 135 | return response 136 | 137 | def _check_response(self, response: Response) -> None: 138 | """Check response does not contain any error.""" 139 | if response.status_code == 200: 140 | return 141 | raw_content = response.text 142 | if "fault" in raw_content: 143 | error_code = response.json()["fault"]["detail"]["errorcode"] 144 | raise SERVER_ERROR.get(error_code, ServerException)(response.json()) 145 | if "message" in raw_content: 146 | message = response.json()["message"] 147 | raise CLIENT_ERROR.get(message, ClientException)(response.json()) 148 | response.raise_for_status() 149 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "pymfy" 3 | version = "0.11.0" 4 | description = "A Somfy Open API library" 5 | authors = ["ETIENNE Thibaut"] 6 | license = "GPL-3.0-only" 7 | readme = "README.md" 8 | homepage = "https://github.com/tetienne/somfy-open-api" 9 | repository = "https://github.com/tetienne/somfy-open-api" 10 | 11 | [tool.poetry.dependencies] 12 | python = ">=3.6.1,<4.0" 13 | requests-oauthlib = "^1.3.0" 14 | 15 | [tool.poetry.dev-dependencies] 16 | tox = ">=3.0" 17 | pytest = ">=4.1" 18 | pytest-cov = ">=2.8.1" 19 | httpretty = ">=1.0.2" 20 | pre-commit = ">=1.10" 21 | flake8 = "^3.9.2" 22 | pylint = "^2.9.6" 23 | pyupgrade = "^2.23.0" 24 | mypy = "^0.812" 25 | black = "^20.8b1" 26 | isort = "^5.9.3" 27 | 28 | [build-system] 29 | requires = ["poetry-core>=1.0.0"] 30 | build-backend = "poetry.core.masonry.api" 31 | 32 | [tool.isort] 33 | profile = "black" 34 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [flake8] 2 | max-line-length = 80 3 | select = C,E,F,W,B,B950 4 | ignore = E501 5 | 6 | [isort] 7 | known_third_party = httpretty,oauthlib,pytest,requests,requests_oauthlib 8 | multi_line_output=3 9 | include_trailing_comma=true 10 | force_grid_wrap=0 11 | use_parentheses=true 12 | line_length=88 13 | 14 | [mypy] 15 | check_untyped_defs = True 16 | disallow_untyped_defs = True 17 | disallow_any_generics = True 18 | warn_no_return = True 19 | no_implicit_optional = True 20 | ignore_missing_imports = True 21 | 22 | [mypy-tests.*] 23 | ignore_errors = True 24 | -------------------------------------------------------------------------------- /tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tetienne/somfy-open-api/056e41ad11440b498417a4b71b8e883738435ba6/tests/__init__.py -------------------------------------------------------------------------------- /tests/blind.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "xxxxxx", 3 | "type": "exterior_blind_positionable_orientable_stateful_generic", 4 | "parent_id": "xxxxxxxxxxxx", 5 | "categories": [ 6 | "exterior_blind" 7 | ], 8 | "states": [ 9 | { 10 | "name": "orientation", 11 | "value": 78, 12 | "type": "integer" 13 | }, 14 | { 15 | "name": "position", 16 | "type": "integer", 17 | "value": 10 18 | } 19 | ], 20 | "capabilities": [ 21 | { 22 | "name": "rotation", 23 | "parameters": [ 24 | { 25 | "name": "orientation", 26 | "type": "integer" 27 | } 28 | ] 29 | }, 30 | { 31 | "name": "position", 32 | "parameters": [ 33 | { 34 | "name": "position", 35 | "type": "integer" 36 | } 37 | ] 38 | }, 39 | { 40 | "name": "close", 41 | "parameters": [ 42 | ] 43 | }, 44 | { 45 | "name": "identify", 46 | "parameters": [ 47 | ] 48 | }, 49 | { 50 | "name": "open", 51 | "parameters": [ 52 | ] 53 | }, 54 | { 55 | "name": "stop", 56 | "parameters": [ 57 | ] 58 | } 59 | ], 60 | "site_id": "xxxxxxxx", 61 | "name": "okno dol", 62 | "available": true 63 | } 64 | -------------------------------------------------------------------------------- /tests/camera.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "device-9", 3 | "type": "camera_protect_somfyone", 4 | "categories": [ 5 | "camera" 6 | ], 7 | "states": [ 8 | { 9 | "name": "shutter_position", 10 | "value": "opened", 11 | "type": "string" 12 | } 13 | ], 14 | "capabilities": [ 15 | { 16 | "name": "shutter_close", 17 | "parameters": [] 18 | }, 19 | { 20 | "name": "shutter_open", 21 | "parameters": [] 22 | } 23 | ], 24 | "site_id": "site-8", 25 | "name": "living" 26 | } 27 | -------------------------------------------------------------------------------- /tests/data/access_token_expired.json: -------------------------------------------------------------------------------- 1 | { 2 | "fault": { 3 | "faultstring": "Access Token expired", 4 | "detail": { 5 | "errorcode": "keymanagement.service.access_token_expired" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/data/definition_not_found.json: -------------------------------------------------------------------------------- 1 | { 2 | "uid": "46779aebccfd", 3 | "message": "definition_not_found", 4 | "data": null 5 | } 6 | -------------------------------------------------------------------------------- /tests/data/device_not_found.json: -------------------------------------------------------------------------------- 1 | { 2 | "uid": "8b09d5a25940", 3 | "message": "device_not_found", 4 | "transactionId": "a2753340-c918-11eb-b171-a9ae9fdd7072", 5 | "data": null 6 | } 7 | -------------------------------------------------------------------------------- /tests/data/invalid_access_token.json: -------------------------------------------------------------------------------- 1 | { 2 | "fault": { 3 | "faultstring": "Invalid access token", 4 | "detail": { 5 | "errorcode": "oauth.v2.InvalidAccessToken" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/data/quota_violation.json: -------------------------------------------------------------------------------- 1 | { 2 | "fault": { 3 | "detail": { 4 | "errorcode": "policies.ratelimit.QuotaViolation" 5 | }, 6 | "faultstring": "Rate limit quota violation. Quota limit exceeded." 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/data/setup_not_found.json: -------------------------------------------------------------------------------- 1 | { 2 | "uid": "867eaca52921", 3 | "message": "setup_not_found", 4 | "transactionId": "4e296110-c90b-11eb-bbf3-619c6ebbae8b", 5 | "data": null 6 | } 7 | -------------------------------------------------------------------------------- /tests/data/site_not_found.json: -------------------------------------------------------------------------------- 1 | { 2 | "uid": "fbd3dd6bab14", 3 | "message": "site_not_found", 4 | "transactionId": "30703f00-c919-11eb-b171-a9ae9fdd7072", 5 | "data": null 6 | } 7 | -------------------------------------------------------------------------------- /tests/data/validate_error.json: -------------------------------------------------------------------------------- 1 | { 2 | "uid": "dd7bf078a314", 3 | "message": "ValidateError", 4 | "transactionId": "2fb262b0-c918-11eb-bbf3-619c6ebbae8b", 5 | "data": { 6 | "fields": { 7 | "command.name": { 8 | "message": "'name' is required" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tests/get_devices_1.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "device-0", 4 | "type": "hub_tahoma_2", 5 | "categories": [ 6 | "hub" 7 | ], 8 | "states": [], 9 | "capabilities": [], 10 | "site_id": "site-1", 11 | "available": true 12 | }, 13 | { 14 | "id": "device-1", 15 | "type": "roller_shutter_positionable_stateful_generic", 16 | "parent_id": "device-0", 17 | "categories": [ 18 | "roller_shutter" 19 | ], 20 | "states": [ 21 | { 22 | "name": "position", 23 | "value": 100, 24 | "type": "integer" 25 | } 26 | ], 27 | "capabilities": [ 28 | { 29 | "name": "position", 30 | "parameters": [ 31 | { 32 | "name": "position", 33 | "type": "integer" 34 | } 35 | ] 36 | }, 37 | { 38 | "name": "close", 39 | "parameters": [] 40 | }, 41 | { 42 | "name": "identify", 43 | "parameters": [] 44 | }, 45 | { 46 | "name": "open", 47 | "parameters": [] 48 | }, 49 | { 50 | "name": "stop", 51 | "parameters": [] 52 | } 53 | ], 54 | "site_id": "site-1", 55 | "name": "Room 1", 56 | "available": true 57 | }, 58 | { 59 | "id": "device-2", 60 | "type": "roller_shutter_positionable_stateful_generic", 61 | "parent_id": "device-0", 62 | "categories": [ 63 | "roller_shutter" 64 | ], 65 | "states": [], 66 | "capabilities": [ 67 | { 68 | "name": "position", 69 | "parameters": [ 70 | { 71 | "name": "position", 72 | "type": "integer" 73 | } 74 | ] 75 | }, 76 | { 77 | "name": "close", 78 | "parameters": [] 79 | }, 80 | { 81 | "name": "identify", 82 | "parameters": [] 83 | }, 84 | { 85 | "name": "open", 86 | "parameters": [] 87 | }, 88 | { 89 | "name": "stop", 90 | "parameters": [] 91 | } 92 | ], 93 | "site_id": "site-1", 94 | "name": "Room 2", 95 | "available": true 96 | } 97 | ] 98 | -------------------------------------------------------------------------------- /tests/get_devices_2.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "device-3", 4 | "type": "roller_shutter_positionable_stateful_generic", 5 | "parent_id": "parent-1", 6 | "categories": [ 7 | "roller_shutter" 8 | ], 9 | "states": [ 10 | { 11 | "name": "position", 12 | "value": 50, 13 | "type": "integer" 14 | } 15 | ], 16 | "capabilities": [ 17 | { 18 | "name": "position", 19 | "parameters": [ 20 | { 21 | "name": "position", 22 | "type": "integer" 23 | } 24 | ] 25 | }, 26 | { 27 | "name": "close", 28 | "parameters": [] 29 | }, 30 | { 31 | "name": "identify", 32 | "parameters": [] 33 | }, 34 | { 35 | "name": "open", 36 | "parameters": [] 37 | }, 38 | { 39 | "name": "stop", 40 | "parameters": [] 41 | } 42 | ], 43 | "site_id": "site-2", 44 | "name": "Room 3", 45 | "available": true 46 | } 47 | ] 48 | -------------------------------------------------------------------------------- /tests/get_site.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "site-1", 3 | "label": "TaHoma" 4 | } 5 | -------------------------------------------------------------------------------- /tests/get_sites.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "id": "site-1", 4 | "label": "TaHoma" 5 | }, 6 | { 7 | "id": "site-2", 8 | "label": "Conexoon" 9 | }, 10 | { 11 | "id": "site-3", 12 | "label": "Other" 13 | } 14 | ] 15 | -------------------------------------------------------------------------------- /tests/hvac.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "device-99", 3 | "type": "hvac_programmable_thermostat_wired", 4 | "categories": [ 5 | "hvac" 6 | ], 7 | "states": [ 8 | { 9 | "name": "ambient_temperature", 10 | "value": 23.3, 11 | "type": "double" 12 | }, 13 | { 14 | "name": "humidity", 15 | "value": 40, 16 | "type": "double" 17 | }, 18 | { 19 | "name": "battery", 20 | "value": 93, 21 | "type": "integer" 22 | }, 23 | { 24 | "name": "hvac_state", 25 | "value": "he", 26 | "type": "string" 27 | }, 28 | { 29 | "name": "regulation_state", 30 | "value": "Derogation", 31 | "type": "string" 32 | }, 33 | { 34 | "name": "target_mode", 35 | "value": "at_home", 36 | "type": "string" 37 | }, 38 | { 39 | "name": "target_temperature", 40 | "value": 18, 41 | "type": "integer" 42 | }, 43 | { 44 | "name": "target_end_date", 45 | "value": 1542741962, 46 | "type": "integer" 47 | }, 48 | { 49 | "name": "target_start_date", 50 | "value": 1542734762, 51 | "type": "integer" 52 | }, 53 | { 54 | "name": "at_home_temperature", 55 | "value": 18, 56 | "type": "integer" 57 | }, 58 | { 59 | "name": "away_temperature", 60 | "value": 15, 61 | "type": "integer" 62 | }, 63 | { 64 | "name": "night_temperature", 65 | "value": 15, 66 | "type": "integer" 67 | }, 68 | { 69 | "name": "frost_protection_temperature", 70 | "value": 8, 71 | "type": "integer" 72 | } 73 | ], 74 | "capabilities": [ 75 | { 76 | "name": "set_target", 77 | "parameters": [ 78 | { 79 | "name": "target_mode", 80 | "type": "string" 81 | }, 82 | { 83 | "name": "target_temperature", 84 | "type": "integer", 85 | "condition": "< 26" 86 | }, 87 | { 88 | "name": "duration", 89 | "type": "integer" 90 | }, 91 | { 92 | "name": "duration_type", 93 | "type": "string" 94 | } 95 | ] 96 | }, 97 | { 98 | "name": "cancel_target", 99 | "parameters": [] 100 | }, 101 | { 102 | "name": "set_at_home_temperature", 103 | "parameters": [ 104 | { 105 | "name": "at_home_temperature", 106 | "type": "integer" 107 | } 108 | ] 109 | }, 110 | { 111 | "name": "set_away_temperature", 112 | "parameters": [ 113 | { 114 | "name": "away_temperature", 115 | "type": "integer" 116 | } 117 | ] 118 | }, 119 | { 120 | "name": "set_night_temperature", 121 | "parameters": [ 122 | { 123 | "name": "night_temperature", 124 | "type": "integer" 125 | } 126 | ] 127 | }, 128 | { 129 | "name": "set_frost_protection_temperature", 130 | "parameters": [ 131 | { 132 | "name": "frost_protection_temperature", 133 | "type": "integer" 134 | } 135 | ] 136 | } 137 | ], 138 | "site_id": "site-1", 139 | "name": "Salon", 140 | "last_status": 1544432025 141 | } 142 | -------------------------------------------------------------------------------- /tests/roller_shutter.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "device-3", 3 | "type": "roller_shutter_positionable_stateful_generic", 4 | "parent_id": "parent-1", 5 | "categories": [ 6 | "roller_shutter" 7 | ], 8 | "states": [ 9 | { 10 | "name": "position", 11 | "value": 50, 12 | "type": "integer" 13 | } 14 | ], 15 | "capabilities": [ 16 | { 17 | "name": "position", 18 | "parameters": [ 19 | { 20 | "name": "position", 21 | "type": "integer" 22 | } 23 | ] 24 | }, 25 | { 26 | "name": "close", 27 | "parameters": [] 28 | }, 29 | { 30 | "name": "identify", 31 | "parameters": [] 32 | }, 33 | { 34 | "name": "open", 35 | "parameters": [] 36 | }, 37 | { 38 | "name": "stop", 39 | "parameters": [] 40 | } 41 | ], 42 | "site_id": "site-2", 43 | "name": "Room 3", 44 | "available": true 45 | } 46 | -------------------------------------------------------------------------------- /tests/roller_shutter_2.json: -------------------------------------------------------------------------------- 1 | { 2 | "id": "device-3", 3 | "type": "roller_shutter_positionable_stateful_generic", 4 | "parent_id": "parent-1", 5 | "categories": [ 6 | "roller_shutter" 7 | ], 8 | "states": [ 9 | { 10 | "name": "position", 11 | "value": 70, 12 | "type": "integer" 13 | } 14 | ], 15 | "capabilities": [ 16 | { 17 | "name": "position", 18 | "parameters": [ 19 | { 20 | "name": "position", 21 | "type": "integer" 22 | } 23 | ] 24 | }, 25 | { 26 | "name": "close", 27 | "parameters": [] 28 | }, 29 | { 30 | "name": "identify", 31 | "parameters": [] 32 | }, 33 | { 34 | "name": "open", 35 | "parameters": [] 36 | }, 37 | { 38 | "name": "stop", 39 | "parameters": [] 40 | } 41 | ], 42 | "site_id": "site-2", 43 | "name": "Room 3", 44 | "available": true 45 | } 46 | -------------------------------------------------------------------------------- /tests/test_blind.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | 4 | import httpretty 5 | from pytest import fixture 6 | 7 | from pymfy.api.devices.blind import Blind 8 | from pymfy.api.model import Device 9 | from pymfy.api.somfy_api import BASE_URL, SomfyApi 10 | 11 | CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) 12 | 13 | 14 | class TestBlind: 15 | @fixture(scope="class") 16 | def device(self): 17 | api = SomfyApi("foo", "faa", "https://whatever.com") 18 | device_path = os.path.join(CURRENT_DIR, "blind.json") 19 | with open(device_path) as get_device: 20 | device = Device(**json.loads(get_device.read())) 21 | return Blind(device, api) 22 | 23 | def test_get_orientation(self, device): 24 | assert device.orientation == 78 25 | 26 | @httpretty.activate 27 | def test_set_orientation(self, device): 28 | url = f"{BASE_URL}/device/xxxxxx/exec" 29 | httpretty.register_uri(httpretty.POST, url, body='{"job_id": "9"}') 30 | device.orientation = 78 31 | assert httpretty.last_request().parsed_body == { # pylint: disable=no-member 32 | "name": "rotation", 33 | "parameters": [{"name": "orientation", "value": 78}], 34 | } 35 | -------------------------------------------------------------------------------- /tests/test_camera_protect.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | 4 | import httpretty 5 | from pytest import fixture 6 | 7 | from pymfy.api.devices.camera_protect import CameraProtect 8 | from pymfy.api.model import Device 9 | from pymfy.api.somfy_api import BASE_URL, SomfyApi 10 | 11 | CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) 12 | 13 | 14 | class TestCameraProtect: 15 | @fixture(scope="class") 16 | def device(self): 17 | api = SomfyApi("foo", "faa", "https://whatever.com") 18 | device_path = os.path.join(CURRENT_DIR, "camera.json") 19 | with open(device_path) as get_device: 20 | device = Device(**json.loads(get_device.read())) 21 | return CameraProtect(device, api) 22 | 23 | @httpretty.activate 24 | def test_open_shutter(self, device): 25 | url = f"{BASE_URL}/device/device-9/exec" 26 | httpretty.register_uri(httpretty.POST, url, body='{"job_id": "9"}') 27 | device.open_shutter() 28 | assert httpretty.last_request().parsed_body == { # pylint: disable=no-member 29 | "name": "shutter_open", 30 | "parameters": [], 31 | } 32 | 33 | @httpretty.activate 34 | def test_close_shutter(self, device): 35 | url = f"{BASE_URL}/device/device-9/exec" 36 | httpretty.register_uri(httpretty.POST, url, body='{"job_id": "9"}') 37 | device.close_shutter() 38 | assert httpretty.last_request().parsed_body == { # pylint: disable=no-member 39 | "name": "shutter_close", 40 | "parameters": [], 41 | } 42 | 43 | def test_get_shutter_position(self, device): 44 | assert device.get_shutter_position() == "opened" 45 | -------------------------------------------------------------------------------- /tests/test_roller_shutter.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | 4 | import httpretty 5 | from pytest import fixture 6 | 7 | from pymfy.api.devices.roller_shutter import RollerShutter 8 | from pymfy.api.model import Device 9 | from pymfy.api.somfy_api import BASE_URL, SomfyApi 10 | 11 | CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) 12 | 13 | 14 | class TestRollerShutter: 15 | @fixture(scope="class") 16 | def device(self): 17 | api = SomfyApi("foo", "faa", "https://whatever.com") 18 | device_path = os.path.join(CURRENT_DIR, "roller_shutter.json") 19 | with open(device_path) as get_device: 20 | device = Device(**json.loads(get_device.read())) 21 | return RollerShutter(device, api) 22 | 23 | def test_get_position(self, device): 24 | assert device.get_position() == 50 25 | 26 | @httpretty.activate 27 | def test_set_position(self, device): 28 | url = f"{BASE_URL}/device/device-3/exec" 29 | httpretty.register_uri(httpretty.POST, url, body='{"job_id": "9"}') 30 | device.set_position(78) 31 | assert httpretty.last_request().parsed_body == { # pylint: disable=no-member 32 | "name": "position", 33 | "parameters": [{"name": "position", "value": 78}], 34 | } 35 | -------------------------------------------------------------------------------- /tests/test_somfy_api.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import httpretty 4 | import pytest 5 | from pytest import fixture 6 | from requests.models import HTTPError 7 | 8 | from pymfy.api.devices.category import Category 9 | from pymfy.api.error import ( 10 | AccessTokenException, 11 | DefinitionNotFoundException, 12 | DeviceNotFoundException, 13 | InvalidAccessTokenException, 14 | QuotaViolationException, 15 | SetupNotFoundException, 16 | SiteNotFoundException, 17 | ValidateException, 18 | ) 19 | from pymfy.api.model import Command, Parameter 20 | from pymfy.api.somfy_api import BASE_URL, SomfyApi 21 | 22 | CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) 23 | 24 | 25 | class TestSomfyApi: 26 | @fixture 27 | def api(self, request): 28 | params = getattr(request, "param", None) or {} 29 | return SomfyApi("foo", "faa", "https://whatever.com", **params) 30 | 31 | @httpretty.activate 32 | def test_get_sites(self, api): 33 | with open(os.path.join(CURRENT_DIR, "get_sites.json")) as get_sites: 34 | httpretty.register_uri( 35 | httpretty.GET, f"{BASE_URL}/site", body=get_sites.read() 36 | ) 37 | sites = api.get_sites() 38 | assert len(sites) == 3 39 | assert sites[0].id == "site-1" 40 | assert sites[0].label == "TaHoma" 41 | assert sites[1].id == "site-2" 42 | assert sites[1].label == "Conexoon" 43 | 44 | @httpretty.activate 45 | def test_get_site(self, api): 46 | with open(os.path.join(CURRENT_DIR, "get_site.json")) as get_site: 47 | httpretty.register_uri( 48 | httpretty.GET, f"{BASE_URL}/site/site-1", body=get_site.read() 49 | ) 50 | site = api.get_site("site-1") 51 | assert site.id == "site-1" 52 | assert site.label == "TaHoma" 53 | 54 | @httpretty.activate 55 | def test_devices(self, api): 56 | sites_path = os.path.join(CURRENT_DIR, "get_sites.json") 57 | devices_path_1 = os.path.join(CURRENT_DIR, "get_devices_1.json") 58 | devices_path_2 = os.path.join(CURRENT_DIR, "get_devices_2.json") 59 | with open(sites_path) as get_sites, open(devices_path_1) as get_devices_1, open( 60 | devices_path_2 61 | ) as get_devices_2: 62 | httpretty.register_uri( 63 | httpretty.GET, f"{BASE_URL}/site", body=get_sites.read() 64 | ) 65 | httpretty.register_uri( 66 | httpretty.GET, 67 | f"{BASE_URL}/site/site-1/device", 68 | body=get_devices_1.read(), 69 | ) 70 | httpretty.register_uri( 71 | httpretty.GET, 72 | f"{BASE_URL}/site/site-2/device", 73 | body=get_devices_2.read(), 74 | ) 75 | 76 | assert len(api.get_devices("site-1")) == 3 77 | assert len(api.get_devices(site_id="site-1")) == 3 78 | assert len(api.get_devices("site-2", Category.ROLLER_SHUTTER)) == 1 79 | 80 | @httpretty.activate 81 | def test_get_device(self, api): 82 | device_path = os.path.join(CURRENT_DIR, "roller_shutter.json") 83 | with open(device_path) as get_device: 84 | httpretty.register_uri( 85 | httpretty.GET, f"{BASE_URL}/device/device-3", body=get_device.read() 86 | ) 87 | device = api.get_device("device-3") 88 | assert device.id == "device-3" 89 | assert device.name == "Room 3" 90 | assert device.states[0].name == "position" 91 | assert device.states[0].value == 50 92 | assert device.states[0].type == "integer" 93 | 94 | @httpretty.activate 95 | def test_send_command(self, api): 96 | # pylint: disable=no-member 97 | url = f"{BASE_URL}/device/my-id/exec" 98 | httpretty.register_uri(httpretty.POST, url, body='{"job_id": "9"}') 99 | 100 | command = Command( 101 | "position", [Parameter("position", 10), Parameter("speed", "slow")] 102 | ) 103 | assert api.send_command("my-id", command) == "9" 104 | assert httpretty.last_request().parsed_body == { 105 | "name": "position", 106 | "parameters": [ 107 | {"name": "position", "value": 10}, 108 | {"name": "speed", "value": "slow"}, 109 | ], 110 | } 111 | 112 | command = Command("position", Parameter("position", 10)) 113 | assert api.send_command("my-id", command) == "9" 114 | assert httpretty.last_request().parsed_body == { 115 | "name": "position", 116 | "parameters": [{"name": "position", "value": 10}], 117 | } 118 | 119 | command = Command("close") 120 | assert api.send_command("my-id", command) == "9" 121 | assert httpretty.last_request().parsed_body == { 122 | "name": "close", 123 | "parameters": [], 124 | } 125 | 126 | assert api.send_command("my-id", "close") == "9" 127 | assert httpretty.last_request().parsed_body == { 128 | "name": "close", 129 | "parameters": [], 130 | } 131 | 132 | @httpretty.activate 133 | @pytest.mark.parametrize( 134 | "api, user_agent", 135 | [({"user_agent": "awesome"}, "awesome"), (None, "pymfy")], 136 | indirect=["api"], 137 | ) 138 | def test_user_agent(self, api, user_agent): 139 | # pylint: disable=no-member 140 | url = f"{BASE_URL}/device/my-id/exec" 141 | httpretty.register_uri(httpretty.POST, url, body='{"job_id": "9"}') 142 | api.send_command("my-id", "close") 143 | assert httpretty.last_request().headers["user-agent"] == user_agent 144 | 145 | @httpretty.activate 146 | @pytest.mark.parametrize( 147 | "api, error_file, exception", 148 | [ 149 | (None, "access_token_expired", AccessTokenException), 150 | (None, "definition_not_found", DefinitionNotFoundException), 151 | (None, "device_not_found", DeviceNotFoundException), 152 | (None, "invalid_access_token", InvalidAccessTokenException), 153 | (None, "quota_violation", QuotaViolationException), 154 | (None, "setup_not_found", SetupNotFoundException), 155 | (None, "site_not_found", SiteNotFoundException), 156 | (None, "validate_error", ValidateException), 157 | ], 158 | indirect=["api"], 159 | ) 160 | def test_error(self, api, error_file, exception): 161 | path = os.path.join(CURRENT_DIR, f"data/{error_file}.json") 162 | with open(path) as error: 163 | httpretty.register_uri( 164 | httpretty.GET, f"{BASE_URL}/site", body=error.read(), status=400 165 | ) 166 | with pytest.raises(exception): 167 | api.get_sites() 168 | 169 | @httpretty.activate 170 | def test_unknown_error(self, api): 171 | httpretty.register_uri(httpretty.GET, f"{BASE_URL}/site", body="", status=404) 172 | with pytest.raises(HTTPError): 173 | api.get_sites() 174 | -------------------------------------------------------------------------------- /tests/test_somfy_device.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | 4 | import httpretty 5 | import pytest 6 | from pytest import fixture 7 | 8 | from pymfy.api.devices.base import SomfyDevice, UnsupportedCommandException 9 | from pymfy.api.model import Command, Device 10 | from pymfy.api.somfy_api import BASE_URL, SomfyApi 11 | 12 | CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) 13 | 14 | 15 | class TestSomfyDevice: 16 | @fixture 17 | def device(self): 18 | api = SomfyApi("foo", "faa", "https://whatever.com") 19 | device_path = os.path.join(CURRENT_DIR, "roller_shutter.json") 20 | with open(device_path) as get_device: 21 | dumb_device = Device(**json.loads(get_device.read())) 22 | return SomfyDevice(dumb_device, api) 23 | 24 | def test_unsupported_command(self, device): 25 | with pytest.raises(UnsupportedCommandException): 26 | device.send_command(Command("GoToTheMoon")) 27 | 28 | @httpretty.activate 29 | def test_send_command(self, device): 30 | url = f"{BASE_URL}/device/{device.device.id}/exec" 31 | httpretty.register_uri(httpretty.POST, url) 32 | # Exception must not be raised 33 | device.send_command(Command("open")) 34 | assert httpretty.last_request().parsed_body == { # pylint: disable=no-member 35 | "name": "open", 36 | "parameters": [], 37 | } 38 | 39 | def test_get_state(self, device): 40 | assert device.get_state("position") == 50 41 | 42 | @httpretty.activate 43 | def test_refresh_state(self, device): 44 | device_path = os.path.join(CURRENT_DIR, "roller_shutter_2.json") 45 | with open(device_path) as get_device: 46 | httpretty.register_uri( 47 | httpretty.GET, f"{BASE_URL}/device/device-3", body=get_device.read() 48 | ) 49 | device.refresh_state() 50 | assert device.get_state("position") == 70 51 | -------------------------------------------------------------------------------- /tests/test_thermostat.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | from datetime import datetime 4 | 5 | import httpretty 6 | from pytest import fixture 7 | 8 | from pymfy.api.devices.thermostat import ( 9 | DurationType, 10 | HvacState, 11 | RegulationState, 12 | TargetMode, 13 | Thermostat, 14 | ) 15 | from pymfy.api.model import Device 16 | from pymfy.api.somfy_api import BASE_URL, SomfyApi 17 | 18 | CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) 19 | 20 | URL = f"{BASE_URL}/device/device-99/exec" 21 | 22 | 23 | @httpretty.activate 24 | class TestThermostat: 25 | @fixture(scope="class") 26 | def device(self): 27 | api = SomfyApi("foo", "faa", "https://whatever.com") 28 | device_path = os.path.join(CURRENT_DIR, "hvac.json") 29 | with open(device_path) as get_device: 30 | device = Device(**json.loads(get_device.read())) 31 | return Thermostat(device, api) 32 | 33 | def test_get_ambient_temperature(self, device): 34 | assert device.get_ambient_temperature() == 23.3 35 | 36 | def test_get_humidity(self, device): 37 | assert device.get_humidity() == 40 38 | 39 | def test_get_battery(self, device): 40 | assert device.get_battery() == 93 41 | 42 | def test_get_hvac_state(self, device): 43 | assert device.get_hvac_state() == HvacState.HEAT 44 | 45 | def test_get_regulation_state(self, device): 46 | assert device.get_regulation_state() == RegulationState.DEROGATION 47 | 48 | def test_get_target_mode(self, device): 49 | assert device.get_target_mode() == TargetMode.AT_HOME 50 | 51 | def test_get_target_get_temperature(self, device): 52 | assert device.get_target_temperature() == 18 53 | 54 | def test_get_target_end_date(self, device): 55 | assert device.get_target_end_date() == datetime(2018, 11, 20, 19, 26, 2) 56 | 57 | def test_get_target_start_date(self, device): 58 | assert device.get_target_start_date() == datetime(2018, 11, 20, 17, 26, 2) 59 | 60 | def test_get_at_home_temperature(self, device): 61 | assert device.get_at_home_temperature() == 18 62 | 63 | def test_get_away_temperature(self, device): 64 | assert device.get_away_temperature() == 15 65 | 66 | def test_get_night_temperature(self, device): 67 | assert device.get_night_temperature() == 15 68 | 69 | def test_get_frost_protection_temperature(self, device): 70 | assert device.get_frost_protection_temperature() == 8 71 | 72 | def test_set_target(self, device): 73 | httpretty.register_uri(httpretty.POST, URL, body='{"job_id": "9"}') 74 | device.set_target(TargetMode.AT_HOME, 18, DurationType.FURTHER_NOTICE, 10) 75 | assert httpretty.last_request().parsed_body == { # pylint: disable=no-member 76 | "name": "set_target", 77 | "parameters": [ 78 | {"name": "target_mode", "value": "at_home"}, 79 | {"name": "target_temperature", "value": 18}, 80 | {"name": "duration_type", "value": "further_notice"}, 81 | {"name": "duration", "value": 10}, 82 | ], 83 | } 84 | 85 | def test_cancel_target(self, device): 86 | httpretty.register_uri(httpretty.POST, URL, body='{"job_id": "9"}') 87 | device.cancel_target() 88 | assert httpretty.last_request().parsed_body == { # pylint: disable=no-member 89 | "name": "cancel_target", 90 | "parameters": [], 91 | } 92 | 93 | def test_set_at_home_temperature(self, device): 94 | httpretty.register_uri(httpretty.POST, URL, body='{"job_id": "9"}') 95 | device.set_at_home_temperature(10) 96 | assert httpretty.last_request().parsed_body == { # pylint: disable=no-member 97 | "name": "set_at_home_temperature", 98 | "parameters": [{"name": "at_home_temperature", "value": 10}], 99 | } 100 | 101 | def test_set_away_temperature(self, device): 102 | httpretty.register_uri(httpretty.POST, URL, body='{"job_id": "9"}') 103 | device.set_away_temperature(12) 104 | assert httpretty.last_request().parsed_body == { # pylint: disable=no-member 105 | "name": "set_away_temperature", 106 | "parameters": [{"name": "away_temperature", "value": 12}], 107 | } 108 | 109 | def test_set_night_temperature(self, device): 110 | httpretty.register_uri(httpretty.POST, URL, body='{"job_id": "9"}') 111 | device.set_night_temperature(13) 112 | assert httpretty.last_request().parsed_body == { # pylint: disable=no-member 113 | "name": "set_night_temperature", 114 | "parameters": [{"name": "night_temperature", "value": 13}], 115 | } 116 | 117 | def test_set_frost_protection_temperature(self, device): 118 | httpretty.register_uri(httpretty.POST, URL, body='{"job_id": "9"}') 119 | device.set_frost_protection_temperature(8) 120 | assert httpretty.last_request().parsed_body == { # pylint: disable=no-member 121 | "name": "set_frost_protection_temperature", 122 | "parameters": [{"name": "frost_protection_temperature", "value": 8}], 123 | } 124 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | isolated_build = true 3 | envlist = lint,python3.{6,7,8,9} 4 | skipsdist = True 5 | 6 | [testenv] 7 | whitelist_externals = poetry 8 | commands = 9 | poetry install 10 | poetry run pytest {posargs} 11 | 12 | [testenv:lint] 13 | basepython = python3.8 14 | skip_install=True 15 | commands = 16 | poetry install 17 | poetry run pre-commit run --all-files 18 | 19 | [gh-actions] 20 | python = 21 | 3.6: python3.6 22 | 3.7: python3.7 23 | 3.8: python3.8, lint 24 | 3.9: python3.9 25 | --------------------------------------------------------------------------------