squarecloud-api 3.7.2__tar.gz → 3.7.4__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 (24) hide show
  1. {squarecloud_api-3.7.2 → squarecloud_api-3.7.4}/LICENSE +19 -19
  2. {squarecloud_api-3.7.2 → squarecloud_api-3.7.4}/PKG-INFO +16 -17
  3. {squarecloud_api-3.7.2 → squarecloud_api-3.7.4}/README.md +54 -60
  4. squarecloud_api-3.7.4/pyproject.toml +147 -0
  5. squarecloud_api-3.7.4/squarecloud/__init__.py +48 -0
  6. {squarecloud_api-3.7.2 → squarecloud_api-3.7.4}/squarecloud/_internal/constants.py +3 -3
  7. squarecloud_api-3.7.4/squarecloud/_internal/decorators.py +16 -0
  8. {squarecloud_api-3.7.2 → squarecloud_api-3.7.4}/squarecloud/app.py +665 -672
  9. {squarecloud_api-3.7.2 → squarecloud_api-3.7.4}/squarecloud/client.py +780 -805
  10. {squarecloud_api-3.7.2 → squarecloud_api-3.7.4}/squarecloud/data.py +332 -366
  11. {squarecloud_api-3.7.2 → squarecloud_api-3.7.4}/squarecloud/errors.py +229 -231
  12. {squarecloud_api-3.7.2 → squarecloud_api-3.7.4}/squarecloud/file.py +60 -61
  13. {squarecloud_api-3.7.2 → squarecloud_api-3.7.4}/squarecloud/http/__init__.py +4 -2
  14. {squarecloud_api-3.7.2 → squarecloud_api-3.7.4}/squarecloud/http/endpoints.py +322 -322
  15. {squarecloud_api-3.7.2 → squarecloud_api-3.7.4}/squarecloud/http/http_client.py +759 -759
  16. {squarecloud_api-3.7.2 → squarecloud_api-3.7.4}/squarecloud/listeners/__init__.py +171 -172
  17. {squarecloud_api-3.7.2 → squarecloud_api-3.7.4}/squarecloud/listeners/capture_listener.py +160 -155
  18. {squarecloud_api-3.7.2 → squarecloud_api-3.7.4}/squarecloud/listeners/request_listener.py +114 -110
  19. squarecloud_api-3.7.2/squarecloud/logging.py → squarecloud_api-3.7.4/squarecloud/logger.py +58 -58
  20. squarecloud_api-3.7.4/squarecloud/py.typed +0 -0
  21. {squarecloud_api-3.7.2 → squarecloud_api-3.7.4}/squarecloud/utils.py +75 -75
  22. squarecloud_api-3.7.2/pyproject.toml +0 -70
  23. squarecloud_api-3.7.2/squarecloud/__init__.py +0 -24
  24. squarecloud_api-3.7.2/squarecloud/_internal/decorators.py +0 -12
@@ -1,20 +1,20 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2022 Robert Nogueira
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy of
6
- this software and associated documentation files (the "Software"), to deal in
7
- the Software without restriction, including without limitation the rights to
8
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
- the Software, and to permit persons to whom the Software is furnished to do so,
10
- subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
- FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
- COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
- IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Robert Nogueira
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9
+ the Software, and to permit persons to whom the Software is furnished to do so,
10
+ subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17
+ FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
20
  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,22 +1,27 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: squarecloud-api
3
- Version: 3.7.2
3
+ Version: 3.7.4
4
4
  Summary: SquareCloud API wrapper
5
- Home-page: https://github.com/squarecloudofc/wrapper-api-py
6
5
  License: MIT
7
6
  Author: Robert Nogueira
8
7
  Author-email: robertlucasnogueira@gmail.com
9
- Requires-Python: >=3.9,<4.0
8
+ Requires-Python: >=3.13,<4.0
10
9
  Classifier: License :: OSI Approved :: MIT License
11
10
  Classifier: Programming Language :: Python :: 3
12
- Classifier: Programming Language :: Python :: 3.9
13
- Classifier: Programming Language :: Python :: 3.10
14
- Classifier: Programming Language :: Python :: 3.11
15
- Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
16
12
  Provides-Extra: pydantic
17
- Requires-Dist: aiohttp (==3.10.2)
18
- Requires-Dist: pydantic (>=2.8.2,<3.0.0) ; extra == "pydantic"
19
- Requires-Dist: taskipy (>=1.13.0,<2.0.0)
13
+ Requires-Dist: aiohttp (>=3.11.14,<4.0.0)
14
+ Requires-Dist: bandit[toml] (>=1.8.3,<2.0.0)
15
+ Requires-Dist: cz-conventional-gitmoji (>=0.7.0,<0.8.0)
16
+ Requires-Dist: isort (>=6.0.1,<7.0.0)
17
+ Requires-Dist: pre-commit (>=4.2.0,<5.0.0)
18
+ Requires-Dist: pydantic (==2.9.2) ; extra == "pydantic"
19
+ Requires-Dist: pytest (>=8.3.5,<9.0.0)
20
+ Requires-Dist: pytest-asyncio (>=0.26.0,<0.27.0)
21
+ Requires-Dist: pytest-cov (>=6.0.0,<7.0.0)
22
+ Requires-Dist: pytest-rerunfailures (>=15.0,<16.0)
23
+ Requires-Dist: ruff (>=0.11.2,<0.12.0)
24
+ Requires-Dist: taskipy (>=1.14.1,<2.0.0)
20
25
  Requires-Dist: typing-extensions (>=4.12.2,<5.0.0)
21
26
  Project-URL: Documentation, https://docs.squarecloud.app/sdks/py
22
27
  Project-URL: Repository, https://github.com/squarecloudofc/wrapper-api-py
@@ -43,12 +48,6 @@ Description-Content-Type: text/markdown
43
48
  pip install squarecloud-api
44
49
  ````
45
50
 
46
- If you intend to use this SDK for command-line interface (CLI) operations, consider
47
- installing it with pipx:
48
- ````shell
49
- pipx install squarecloud-api
50
- ````
51
-
52
51
  ## Getting api key
53
52
 
54
53
  to get your api key/token just go to the [Square Cloud] website and
@@ -1,60 +1,54 @@
1
- [Square Cloud]: https://squarecloud.app
2
-
3
- [Square Cloud API]: https://docs.squarecloud.app/api-reference/
4
-
5
- [@allma]: https://github.com/Robert-Nogueira
6
-
7
-
8
- <div align="center">
9
- <img alt="Square Cloud Banner" src="https://cdn.squarecloud.app/png/github-readme.png">
10
- </div>
11
-
12
- <h1 align="center">squarecloud-api</h1>
13
-
14
- <p align="center">A Python SDK for consuming the <a href="https://squarecloud.app" target="_blank">Square Cloud</a> API.</p>
15
-
16
- ## Installation
17
-
18
- ````shell
19
- pip install squarecloud-api
20
- ````
21
-
22
- If you intend to use this SDK for command-line interface (CLI) operations, consider
23
- installing it with pipx:
24
- ````shell
25
- pipx install squarecloud-api
26
- ````
27
-
28
- ## Getting api key
29
-
30
- to get your api key/token just go to the [Square Cloud] website and
31
- register/login, after that go
32
- to `dashboard` > `my account` > `Regenerate API/CLI KEY` and copy the key.
33
-
34
- ## Documentation
35
- Visit our [official documentation](https://docs.squarecloud.app/sdks/py) for more information about how to use this library.
36
-
37
- ## Getting started
38
-
39
- ```python
40
- import asyncio
41
- import squarecloud as square
42
-
43
- client = square.Client('API_KEY')
44
-
45
- async def main():
46
- status = await client.app_status(app_id='application_id')
47
- print(status)
48
- print(status.ram)
49
- print(status.cpu)
50
-
51
- asyncio.run(main())
52
- ```
53
-
54
- ## Contributing
55
-
56
- Feel free to contribute with suggestions or bug reports at our [GitHub repository](https://github.com/squarecloudofc/wrapper-api-py).
57
-
58
- ## Authors
59
-
60
- - [@allma]
1
+ [Square Cloud]: https://squarecloud.app
2
+
3
+ [Square Cloud API]: https://docs.squarecloud.app/api-reference/
4
+
5
+ [@allma]: https://github.com/Robert-Nogueira
6
+
7
+
8
+ <div align="center">
9
+ <img alt="Square Cloud Banner" src="https://cdn.squarecloud.app/png/github-readme.png">
10
+ </div>
11
+
12
+ <h1 align="center">squarecloud-api</h1>
13
+
14
+ <p align="center">A Python SDK for consuming the <a href="https://squarecloud.app" target="_blank">Square Cloud</a> API.</p>
15
+
16
+ ## Installation
17
+
18
+ ````shell
19
+ pip install squarecloud-api
20
+ ````
21
+
22
+ ## Getting api key
23
+
24
+ to get your api key/token just go to the [Square Cloud] website and
25
+ register/login, after that go
26
+ to `dashboard` > `my account` > `Regenerate API/CLI KEY` and copy the key.
27
+
28
+ ## Documentation
29
+ Visit our [official documentation](https://docs.squarecloud.app/sdks/py) for more information about how to use this library.
30
+
31
+ ## Getting started
32
+
33
+ ```python
34
+ import asyncio
35
+ import squarecloud as square
36
+
37
+ client = square.Client('API_KEY')
38
+
39
+ async def main():
40
+ status = await client.app_status(app_id='application_id')
41
+ print(status)
42
+ print(status.ram)
43
+ print(status.cpu)
44
+
45
+ asyncio.run(main())
46
+ ```
47
+
48
+ ## Contributing
49
+
50
+ Feel free to contribute with suggestions or bug reports at our [GitHub repository](https://github.com/squarecloudofc/wrapper-api-py).
51
+
52
+ ## Authors
53
+
54
+ - [@allma]
@@ -0,0 +1,147 @@
1
+ [tool.poetry]
2
+ name = 'squarecloud-api'
3
+ version = '3.7.4'
4
+ description = 'SquareCloud API wrapper'
5
+ authors = ['Robert Nogueira <robertlucasnogueira@gmail.com>']
6
+ repository = 'https://github.com/squarecloudofc/wrapper-api-py'
7
+ documentation = 'https://docs.squarecloud.app/sdks/py'
8
+ license = 'MIT License'
9
+ readme = 'README.md'
10
+ packages = [{ include = "squarecloud" }]
11
+
12
+
13
+ [tool.poetry.dependencies]
14
+ python = '^3.13'
15
+ typing-extensions = "^4.12.2"
16
+ aiohttp = "^3.11.14"
17
+ isort = "^6.0.1"
18
+ pre-commit = "^4.2.0"
19
+ pytest = "^8.3.5"
20
+ pytest-asyncio = "^0.26.0"
21
+ pytest-cov = "^6.0.0"
22
+ pytest-rerunfailures = "^15.0"
23
+ ruff = "^0.11.2"
24
+ taskipy = "^1.14.1"
25
+ pydantic = "2.9.2"
26
+ bandit = {extras = ["toml"], version = "^1.8.3"}
27
+ cz-conventional-gitmoji = "^0.7.0"
28
+
29
+ [tool.poetry.extras]
30
+ pydantic = ["pydantic"]
31
+
32
+ [tool.poetry.group.dev.dependencies]
33
+ memory-profiler = '^0.61.0'
34
+ requests = '^2.31.0'
35
+ python-dotenv = "^1.0.1"
36
+ safety = "^3.3.1"
37
+ vulture = "^2.14"
38
+ mypy-extensions = "^1.0.0"
39
+ commitizen = "^4.5.1"
40
+ bandit = "^1.8.3"
41
+
42
+ [build-system]
43
+ requires = ['poetry-core']
44
+ build-backend = 'poetry.core.masonry.api'
45
+
46
+ [tool.pytest.ini_options]
47
+ asyncio_mode = 'auto'
48
+ markers = [
49
+ 'app',
50
+ 'app_data',
51
+ 'listeners',
52
+ 'capture_listener',
53
+ 'request_listener',
54
+ 'files',
55
+ 'upload',
56
+ ]
57
+
58
+ [tool.isort]
59
+ profile = 'black'
60
+ line_length = 79
61
+
62
+ [tool.taskipy.tasks]
63
+ lint = 'isort . && blue . && ruff check .'
64
+ pre_test = 'task lint'
65
+ test = 'pytest -vv -s --reruns 5 --only-rerun TooManyRequests --reruns-delay 90 -x --cov=tests tests'
66
+ post_test = 'coverage html'
67
+ publish-test = 'poetry publish -r pypi-test --build'
68
+ install-test = 'pip install -i https://test.pypi.org/pypi/ --extra-index-url https://pypi.org/simple --upgrade squarecloud-api'
69
+ clear-test-apps = 'python -m scripts.clear_test_apps'
70
+
71
+ [tool.ruff]
72
+ line-length = 79
73
+ exclude = ['env', 'tests']
74
+
75
+ [tool.bandit]
76
+ exclude_dirs = ["docs", "venv", "migrations", "examples", "tests"]
77
+ skips = ["B101", "B311"]
78
+ severity_threshold = "low"
79
+ confidence_threshold = "low"
80
+ recursive = true
81
+ quiet = false
82
+
83
+ [tool.bandit.tests]
84
+ B102 = "exec_used" # Use of 'exec' detected
85
+ B103 = "set_bad_file_permissions" # Insecure file permissions
86
+ B104 = "hardcoded_bind_all_interfaces" # Binding to all interfaces
87
+ B105 = "hardcoded_password_string" # Hardcoded password in a string
88
+ B106 = "hardcoded_password_funcarg" # Hardcoded password in function argument
89
+ B107 = "hardcoded_password_default" # Hardcoded password in a default argument
90
+ B108 = "hardcoded_tmp_directory" # Use of hardcoded temporary directory
91
+ B109 = "password_config_option_not_marked_secret" # Password config not marked as secret
92
+ B110 = "try_except_pass" # 'try-except-pass' pattern detected
93
+ B111 = "execute_with_run_as_root_equals_true" # Executing with 'run_as_root=True'
94
+ B112 = "try_except_continue" # 'try-except-continue' pattern detected
95
+ B113 = "request_without_timeout" # HTTP request without a timeout
96
+
97
+ # Security vulnerabilities in web applications
98
+ B201 = "flask_debug_true" # Flask app running with 'debug=True'
99
+ B202 = "tarfile_unsafe_members" # Tarfile extract with unsafe members
100
+
101
+ # Cryptography-related issues
102
+ B324 = "hashlib" # Weak or insecure hash function
103
+
104
+ # SSL/TLS issues
105
+ B501 = "request_with_no_cert_validation" # Requests without certificate validation
106
+ B502 = "ssl_with_bad_version" # Use of outdated SSL versions
107
+ B503 = "ssl_with_bad_defaults" # Insecure SSL defaults
108
+ B504 = "ssl_with_no_version" # SSL/TLS without specifying a version
109
+ B505 = "weak_cryptographic_key" # Weak cryptographic key detected
110
+
111
+ # Serialization & data handling
112
+ B506 = "yaml_load" # Use of unsafe 'yaml.load'
113
+ B507 = "ssh_no_host_key_verification" # SSH without host key verification
114
+ B508 = "snmp_insecure_version" # Insecure SNMP version used
115
+ B509 = "snmp_weak_cryptography" # Weak SNMP cryptography used
116
+
117
+ # Process execution risks
118
+ B601 = "paramiko_calls" # Use of Paramiko library detected
119
+ B602 = "subprocess_popen_with_shell_equals_true" # Popen with 'shell=True'
120
+ B603 = "subprocess_without_shell_equals_true" # Popen without 'shell=True'
121
+ B604 = "any_other_function_with_shell_equals_true" # Dangerous shell execution function
122
+ B605 = "start_process_with_a_shell" # Starting a process with a shell
123
+ B606 = "start_process_with_no_shell" # Process started without shell
124
+ B607 = "start_process_with_partial_path" # Process started with a partial path
125
+
126
+ # Database security
127
+ B608 = "hardcoded_sql_expressions" # Hardcoded SQL expressions detected
128
+ B609 = "linux_commands_wildcard_injection" # Linux command injection via wildcards
129
+ B610 = "django_extra_used" # Use of Django's 'extra()' method
130
+ B611 = "django_rawsql_used" # Use of raw SQL in Django
131
+ B612 = "logging_config_insecure_listen" # Insecure logging configuration
132
+
133
+ # Miscellaneous security issues
134
+ B613 = "trojansource" # Trojan Source attack patterns detected
135
+ B614 = "pytorch_load" # Use of 'torch.load', which can be unsafe
136
+
137
+ # Template security risks
138
+ B701 = "jinja2_autoescape_false" # Jinja2 autoescape disabled
139
+ B702 = "use_of_mako_templates" # Use of Mako templates detected
140
+ B703 = "django_mark_safe" # Use of Django's 'mark_safe'
141
+ B704 = "markupsafe_markup_xss" # Potential XSS via MarkupSafe
142
+
143
+ [tool.commitizen]
144
+ name = "cz_gitmoji"
145
+
146
+ [tool.ruff.lint.per-file-ignores]
147
+ '__init__.py' = ['F401']
@@ -0,0 +1,48 @@
1
+ from __future__ import annotations
2
+
3
+ from . import errors, utils
4
+ from .app import Application
5
+ from .client import Client
6
+ from .data import (
7
+ AppData,
8
+ Backup,
9
+ BackupInfo,
10
+ DeployData,
11
+ DNSRecord,
12
+ DomainAnalytics,
13
+ FileInfo,
14
+ LogsData,
15
+ PlanData,
16
+ ResumedStatus,
17
+ StatusData,
18
+ UploadData,
19
+ UserData,
20
+ )
21
+ from .file import File
22
+ from .http.endpoints import Endpoint
23
+ from .http.http_client import Response
24
+
25
+ __all__ = [
26
+ 'Application',
27
+ 'Client',
28
+ 'File',
29
+ 'Endpoint',
30
+ 'Response',
31
+ 'AppData',
32
+ 'Backup',
33
+ 'BackupInfo',
34
+ 'DeployData',
35
+ 'DNSRecord',
36
+ 'DomainAnalytics',
37
+ 'FileInfo',
38
+ 'LogsData',
39
+ 'PlanData',
40
+ 'ResumedStatus',
41
+ 'StatusData',
42
+ 'UploadData',
43
+ 'UserData',
44
+ 'errors',
45
+ 'utils',
46
+ ]
47
+
48
+ __version__ = '3.7.4'
@@ -1,3 +1,3 @@
1
- from importlib.util import find_spec
2
-
3
- USING_PYDANTIC = bool(find_spec('pydantic'))
1
+ from importlib.util import find_spec
2
+
3
+ USING_PYDANTIC = bool(find_spec('pydantic'))
@@ -0,0 +1,16 @@
1
+ from typing import Any, Callable, TypeVar
2
+
3
+ from .constants import USING_PYDANTIC
4
+
5
+ if USING_PYDANTIC:
6
+ from pydantic import ConfigDict, validate_call
7
+
8
+ F = TypeVar('F', bound=Callable[..., Any])
9
+
10
+
11
+ def validate(func: F) -> Callable[..., Any] | F:
12
+ if USING_PYDANTIC:
13
+ return validate_call(config=ConfigDict(arbitrary_types_allowed=True))(
14
+ func
15
+ )
16
+ return func