amcrest-api 0.1.1a1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. amcrest_api-0.1.1a1/.github/workflows/build-and-publish.yaml +22 -0
  2. amcrest_api-0.1.1a1/.github/workflows/test.yaml +40 -0
  3. amcrest_api-0.1.1a1/.gitignore +176 -0
  4. amcrest_api-0.1.1a1/.pre-commit-config.yaml +49 -0
  5. amcrest_api-0.1.1a1/.python-version +1 -0
  6. amcrest_api-0.1.1a1/.secrets.baseline +127 -0
  7. amcrest_api-0.1.1a1/.vscode/launch.json +12 -0
  8. amcrest_api-0.1.1a1/.vscode/settings.json +10 -0
  9. amcrest_api-0.1.1a1/LICENSE +7 -0
  10. amcrest_api-0.1.1a1/PKG-INFO +19 -0
  11. amcrest_api-0.1.1a1/README.md +7 -0
  12. amcrest_api-0.1.1a1/amcrest_api/__init__.py +18 -0
  13. amcrest_api-0.1.1a1/amcrest_api/__main__.py +225 -0
  14. amcrest_api-0.1.1a1/amcrest_api/camera.py +591 -0
  15. amcrest_api-0.1.1a1/amcrest_api/config.py +26 -0
  16. amcrest_api-0.1.1a1/amcrest_api/const.py +40 -0
  17. amcrest_api-0.1.1a1/amcrest_api/error.py +5 -0
  18. amcrest_api-0.1.1a1/amcrest_api/event.py +130 -0
  19. amcrest_api-0.1.1a1/amcrest_api/imaging.py +168 -0
  20. amcrest_api-0.1.1a1/amcrest_api/ptz.py +369 -0
  21. amcrest_api-0.1.1a1/amcrest_api/storage.py +52 -0
  22. amcrest_api-0.1.1a1/amcrest_api/utils.py +47 -0
  23. amcrest_api-0.1.1a1/coverage.svg +21 -0
  24. amcrest_api-0.1.1a1/hooks/runtests.sh +3 -0
  25. amcrest_api-0.1.1a1/pyproject.toml +64 -0
  26. amcrest_api-0.1.1a1/requirements.txt +676 -0
  27. amcrest_api-0.1.1a1/tests/__snapshots__/test_camera.ambr +49 -0
  28. amcrest_api-0.1.1a1/tests/__snapshots__/test_utils.ambr +97 -0
  29. amcrest_api-0.1.1a1/tests/conftest.py +75 -0
  30. amcrest_api-0.1.1a1/tests/fixtures/MockJsonPayload.json +7 -0
  31. amcrest_api-0.1.1a1/tests/fixtures/MockKeyValuePayloadTable.txt +6 -0
  32. amcrest_api-0.1.1a1/tests/fixtures/MockKeyValuePayloadWithArray.txt +49 -0
  33. amcrest_api-0.1.1a1/tests/fixtures/mock_event_multipart_responses/heartbeat.txt +1 -0
  34. amcrest_api-0.1.1a1/tests/fixtures/mock_event_multipart_responses/video_motion_stop.txt +4 -0
  35. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/device_type.json +4 -0
  36. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/exposure_events.json +4 -0
  37. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/general_config.json +4 -0
  38. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/get_current_time.json +4 -0
  39. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/get_lelensmask.json +4 -0
  40. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/get_lesmarttrack.json +4 -0
  41. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/hardware_version.json +4 -0
  42. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/lighting_config.json +4 -0
  43. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/lighting_config_v2.json +4 -0
  44. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/max_extra_stream.json +4 -0
  45. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/network_config.json +4 -0
  46. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/ptz_capabilities.json +4 -0
  47. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/ptz_config.json +4 -0
  48. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/ptz_status.json +4 -0
  49. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/rtspconfig.json +4 -0
  50. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/serial_number.json +4 -0
  51. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/software_version.json +4 -0
  52. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/storage_device_info_all.json +4 -0
  53. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/video_image_control.json +4 -0
  54. amcrest_api-0.1.1a1/tests/fixtures/mock_responses/video_in_day_night.json +4 -0
  55. amcrest_api-0.1.1a1/tests/test_camera.py +122 -0
  56. amcrest_api-0.1.1a1/tests/test_events.py +31 -0
  57. amcrest_api-0.1.1a1/tests/test_ptz.py +50 -0
  58. amcrest_api-0.1.1a1/tests/test_utils.py +64 -0
  59. amcrest_api-0.1.1a1/tests/utils.py +33 -0
  60. amcrest_api-0.1.1a1/uv.lock +1137 -0
@@ -0,0 +1,22 @@
1
+ name: Build and Publish
2
+
3
+ on:
4
+ release:
5
+ types: [released]
6
+
7
+ jobs:
8
+ build-and-publish:
9
+ runs-on: "ubuntu-latest"
10
+ permissions:
11
+ id-token: write
12
+ environment:
13
+ name: release
14
+ url: https://pypi.org/p/amcrest_api
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ - name: Install uv
18
+ uses: astral-sh/setup-uv@v5
19
+ - name: Build the project
20
+ run: uv build
21
+ - name: Publish through Trusted Publisher
22
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,40 @@
1
+ name: Run Tests
2
+
3
+ on:
4
+ push:
5
+ pull_request:
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ uv-pytest:
10
+ runs-on: "ubuntu-latest"
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - name: "Install uv"
14
+ uses: astral-sh/setup-uv@v5
15
+ with:
16
+ version: "0.7.13"
17
+ - name: "Set up Python"
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version-file: ".python-version"
21
+ - name: "Install the project"
22
+ run: uv sync --locked --all-extras --dev
23
+ - name: "Run tests"
24
+ run: uv run pytest tests
25
+ - name: Test Summary
26
+ uses: test-summary/action@v2
27
+ with:
28
+ paths: |
29
+ test_results.xml
30
+ - name: Code Coverage Report
31
+ uses: irongut/CodeCoverageSummary@v1.3.0
32
+ with:
33
+ filename: coverage.xml
34
+ badge: true
35
+ fail_below_min: false
36
+ format: markdown
37
+ output: both
38
+ if: always()
39
+ - name: "Build Dist"
40
+ run: uv build
@@ -0,0 +1,176 @@
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
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ test_results.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ #Pipfile.lock
97
+
98
+ # UV
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ #uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ #poetry.lock
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ #pdm.lock
114
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
115
+ # in version control.
116
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
117
+ .pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
122
+ __pypackages__/
123
+
124
+ # Celery stuff
125
+ celerybeat-schedule
126
+ celerybeat.pid
127
+
128
+ # SageMath parsed files
129
+ *.sage.py
130
+
131
+ # Environments
132
+ .env
133
+ .venv
134
+ env/
135
+ venv/
136
+ ENV/
137
+ env.bak/
138
+ venv.bak/
139
+
140
+ # Spyder project settings
141
+ .spyderproject
142
+ .spyproject
143
+
144
+ # Rope project settings
145
+ .ropeproject
146
+
147
+ # mkdocs documentation
148
+ /site
149
+
150
+ # mypy
151
+ .mypy_cache/
152
+ .dmypy.json
153
+ dmypy.json
154
+
155
+ # ruff
156
+ .ruff_cache/
157
+
158
+ # Pyre type checker
159
+ .pyre/
160
+
161
+ # pytype static type analyzer
162
+ .pytype/
163
+
164
+ # Cython debug symbols
165
+ cython_debug/
166
+
167
+ # PyCharm
168
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
169
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
170
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
171
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
172
+ #.idea/
173
+
174
+ # PyPI configuration file
175
+ .pypirc
176
+ uv.toml
@@ -0,0 +1,49 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: check-added-large-files
9
+ - id: check-json
10
+ - id: check-toml
11
+ - id: pretty-format-json
12
+ args: [ --autofix ]
13
+ - repo: https://github.com/astral-sh/ruff-pre-commit
14
+ rev: v0.12.1
15
+ hooks:
16
+ - id: ruff
17
+ args: [ --fix ]
18
+ - id: ruff-format
19
+ - repo: https://github.com/pre-commit/mirrors-mypy
20
+ rev: 'v1.16.1' # Use the sha / tag you want to point at
21
+ hooks:
22
+ - id: mypy
23
+ - repo: https://github.com/codespell-project/codespell
24
+ rev: v2.4.1
25
+ hooks:
26
+ - id: codespell
27
+ exclude: "^tests/fixtures/mock_responses|uv.lock|requirements.txt"
28
+ - repo: https://github.com/astral-sh/uv-pre-commit
29
+ # uv version.
30
+ rev: 0.7.15
31
+ hooks:
32
+ - id: uv-lock
33
+ - id: uv-export
34
+ - repo: https://github.com/Yelp/detect-secrets
35
+ rev: v1.5.0
36
+ hooks:
37
+ - id: detect-secrets
38
+ args: ['--baseline', '.secrets.baseline']
39
+ exclude: package.lock.json
40
+ - repo: local
41
+ hooks:
42
+ - id: pytest
43
+ name: pytest
44
+ language: system
45
+ entry: sh hooks/runtests.sh
46
+ files: ^(custom_components/.*\.py|tests/.*\.py)$
47
+
48
+ ci:
49
+ skip: [ pytest ]
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,127 @@
1
+ {
2
+ "version": "1.5.0",
3
+ "plugins_used": [
4
+ {
5
+ "name": "ArtifactoryDetector"
6
+ },
7
+ {
8
+ "name": "AWSKeyDetector"
9
+ },
10
+ {
11
+ "name": "AzureStorageKeyDetector"
12
+ },
13
+ {
14
+ "name": "Base64HighEntropyString",
15
+ "limit": 4.5
16
+ },
17
+ {
18
+ "name": "BasicAuthDetector"
19
+ },
20
+ {
21
+ "name": "CloudantDetector"
22
+ },
23
+ {
24
+ "name": "DiscordBotTokenDetector"
25
+ },
26
+ {
27
+ "name": "GitHubTokenDetector"
28
+ },
29
+ {
30
+ "name": "GitLabTokenDetector"
31
+ },
32
+ {
33
+ "name": "HexHighEntropyString",
34
+ "limit": 3.0
35
+ },
36
+ {
37
+ "name": "IbmCloudIamDetector"
38
+ },
39
+ {
40
+ "name": "IbmCosHmacDetector"
41
+ },
42
+ {
43
+ "name": "IPPublicDetector"
44
+ },
45
+ {
46
+ "name": "JwtTokenDetector"
47
+ },
48
+ {
49
+ "name": "KeywordDetector",
50
+ "keyword_exclude": ""
51
+ },
52
+ {
53
+ "name": "MailchimpDetector"
54
+ },
55
+ {
56
+ "name": "NpmDetector"
57
+ },
58
+ {
59
+ "name": "OpenAIDetector"
60
+ },
61
+ {
62
+ "name": "PrivateKeyDetector"
63
+ },
64
+ {
65
+ "name": "PypiTokenDetector"
66
+ },
67
+ {
68
+ "name": "SendGridDetector"
69
+ },
70
+ {
71
+ "name": "SlackDetector"
72
+ },
73
+ {
74
+ "name": "SoftlayerDetector"
75
+ },
76
+ {
77
+ "name": "SquareOAuthDetector"
78
+ },
79
+ {
80
+ "name": "StripeDetector"
81
+ },
82
+ {
83
+ "name": "TelegramBotTokenDetector"
84
+ },
85
+ {
86
+ "name": "TwilioKeyDetector"
87
+ }
88
+ ],
89
+ "filters_used": [
90
+ {
91
+ "path": "detect_secrets.filters.allowlist.is_line_allowlisted"
92
+ },
93
+ {
94
+ "path": "detect_secrets.filters.common.is_ignored_due_to_verification_policies",
95
+ "min_level": 2
96
+ },
97
+ {
98
+ "path": "detect_secrets.filters.heuristic.is_indirect_reference"
99
+ },
100
+ {
101
+ "path": "detect_secrets.filters.heuristic.is_likely_id_string"
102
+ },
103
+ {
104
+ "path": "detect_secrets.filters.heuristic.is_lock_file"
105
+ },
106
+ {
107
+ "path": "detect_secrets.filters.heuristic.is_not_alphanumeric_string"
108
+ },
109
+ {
110
+ "path": "detect_secrets.filters.heuristic.is_potential_uuid"
111
+ },
112
+ {
113
+ "path": "detect_secrets.filters.heuristic.is_prefixed_with_dollar_sign"
114
+ },
115
+ {
116
+ "path": "detect_secrets.filters.heuristic.is_sequential_string"
117
+ },
118
+ {
119
+ "path": "detect_secrets.filters.heuristic.is_swagger_file"
120
+ },
121
+ {
122
+ "path": "detect_secrets.filters.heuristic.is_templated_secret"
123
+ }
124
+ ],
125
+ "results": {},
126
+ "generated_at": "2025-01-25T05:14:14Z"
127
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "configurations": [
3
+ {
4
+ "envFile": "${workspaceFolder}/.env",
5
+ "module": "amcrest_api",
6
+ "name": "Python Debugger: Module",
7
+ "request": "launch",
8
+ "type": "debugpy"
9
+ }
10
+ ],
11
+ "version": "0.2.0"
12
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "pylint.interpreter": [
3
+ "./.venv/bin/python"
4
+ ],
5
+ "python.testing.pytestArgs": [
6
+ "tests"
7
+ ],
8
+ "python.testing.pytestEnabled": true,
9
+ "python.testing.unittestEnabled": false
10
+ }
@@ -0,0 +1,7 @@
1
+ Copyright (c) 2025 Benjamin Pearce
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,19 @@
1
+ Metadata-Version: 2.4
2
+ Name: amcrest_api
3
+ Version: 0.1.1a1
4
+ Summary: Python Wrapper for Amcrest API v3.26 or greater.
5
+ Author-email: Benjamin Pearce <amcrest_api@bcpearce.com>
6
+ License-Expression: MIT
7
+ License-File: LICENSE
8
+ Requires-Python: >=3.9
9
+ Requires-Dist: httpx>=0.27.2
10
+ Requires-Dist: yarl>=1.15.2
11
+ Description-Content-Type: text/markdown
12
+
13
+ # Amcrest API
14
+
15
+ Python wrapper for [Amcrest API version 3.26](https://support.amcrest.com/hc/en-us/articles/17903073032973-Amcrest-HTTP-API-SDK).
16
+
17
+ ![test coverage](./coverage.svg)'
18
+
19
+ Implements asynchronous operations for Amcrest cameras for use with [HomeAssistant Amcrest Custom](https://github.com/bcpearce/homeassistant-amcrest-custom)
@@ -0,0 +1,7 @@
1
+ # Amcrest API
2
+
3
+ Python wrapper for [Amcrest API version 3.26](https://support.amcrest.com/hc/en-us/articles/17903073032973-Amcrest-HTTP-API-SDK).
4
+
5
+ ![test coverage](./coverage.svg)'
6
+
7
+ Implements asynchronous operations for Amcrest cameras for use with [HomeAssistant Amcrest Custom](https://github.com/bcpearce/homeassistant-amcrest-custom)
@@ -0,0 +1,18 @@
1
+ """
2
+ API Wrapper for Amcrest V3.26
3
+
4
+ https://support.amcrest.com/hc/en-us/articles/17903073032973-Amcrest-HTTP-API-SDK
5
+ """
6
+
7
+ from importlib import metadata as importlib_metadata
8
+
9
+
10
+ def get_version() -> str:
11
+ """Version."""
12
+ try:
13
+ return importlib_metadata.version(__name__)
14
+ except importlib_metadata.PackageNotFoundError: # pragma: no cover
15
+ return "unknown"
16
+
17
+
18
+ version: str = get_version()