squarecloud-api 3.6.1__tar.gz → 3.6.2__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 (19) hide show
  1. {squarecloud_api-3.6.1 → squarecloud_api-3.6.2}/PKG-INFO +3 -2
  2. {squarecloud_api-3.6.1 → squarecloud_api-3.6.2}/pyproject.toml +7 -2
  3. {squarecloud_api-3.6.1 → squarecloud_api-3.6.2}/squarecloud/__init__.py +1 -1
  4. {squarecloud_api-3.6.1 → squarecloud_api-3.6.2}/squarecloud/app.py +2 -4
  5. {squarecloud_api-3.6.1 → squarecloud_api-3.6.2}/squarecloud/client.py +4 -2
  6. {squarecloud_api-3.6.1 → squarecloud_api-3.6.2}/squarecloud/data.py +16 -13
  7. {squarecloud_api-3.6.1 → squarecloud_api-3.6.2}/squarecloud/http/http_client.py +1 -1
  8. {squarecloud_api-3.6.1 → squarecloud_api-3.6.2}/squarecloud/listeners/__init__.py +6 -4
  9. {squarecloud_api-3.6.1 → squarecloud_api-3.6.2}/squarecloud/listeners/capture_listener.py +4 -2
  10. {squarecloud_api-3.6.1 → squarecloud_api-3.6.2}/squarecloud/listeners/request_listener.py +5 -1
  11. squarecloud_api-3.6.2/squarecloud/teste_foda.py +0 -0
  12. {squarecloud_api-3.6.1 → squarecloud_api-3.6.2}/LICENSE +0 -0
  13. {squarecloud_api-3.6.1 → squarecloud_api-3.6.2}/README.md +0 -0
  14. {squarecloud_api-3.6.1 → squarecloud_api-3.6.2}/squarecloud/errors.py +0 -0
  15. {squarecloud_api-3.6.1 → squarecloud_api-3.6.2}/squarecloud/file.py +0 -0
  16. {squarecloud_api-3.6.1 → squarecloud_api-3.6.2}/squarecloud/http/__init__.py +0 -0
  17. {squarecloud_api-3.6.1 → squarecloud_api-3.6.2}/squarecloud/http/endpoints.py +0 -0
  18. {squarecloud_api-3.6.1 → squarecloud_api-3.6.2}/squarecloud/logging.py +0 -0
  19. {squarecloud_api-3.6.1 → squarecloud_api-3.6.2}/squarecloud/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: squarecloud-api
3
- Version: 3.6.1
3
+ Version: 3.6.2
4
4
  Summary: SquareCloud API wrapper
5
5
  Home-page: https://github.com/squarecloudofc/wrapper-api-py
6
6
  License: MIT
@@ -13,8 +13,9 @@ Classifier: Programming Language :: Python :: 3.9
13
13
  Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
+ Provides-Extra: pydantic
16
17
  Requires-Dist: aiohttp (==3.9.5)
17
- Requires-Dist: pydantic (>=2.5.2,<3.0.0)
18
+ Requires-Dist: pydantic (>=2.8.2,<3.0.0) ; extra == "pydantic"
18
19
  Requires-Dist: taskipy (>=1.13.0,<2.0.0)
19
20
  Project-URL: Documentation, https://docs.squarecloud.app/sdks/py
20
21
  Project-URL: Repository, https://github.com/squarecloudofc/wrapper-api-py
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = 'squarecloud-api'
3
- version = '3.6.1'
3
+ version = '3.6.2'
4
4
  description = 'SquareCloud API wrapper'
5
5
  authors = ['Robert Nogueira <robertlucasnogueira@gmail.com>']
6
6
  repository = 'https://github.com/squarecloudofc/wrapper-api-py'
@@ -12,8 +12,11 @@ packages = [{ include = 'squarecloud' }]
12
12
  [tool.poetry.dependencies]
13
13
  python = '^3.9'
14
14
  aiohttp = "3.9.5"
15
- pydantic = '^2.5.2'
16
15
  taskipy = "^1.13.0"
16
+ pydantic = {version = "^2.8.2", optional = true}
17
+
18
+ [tool.poetry.extras]
19
+ pydantic = ["pydantic"]
17
20
 
18
21
  [tool.poetry.group.dev.dependencies]
19
22
  pytest = '^7.4.3'
@@ -26,6 +29,8 @@ ruff = '^0.0.289'
26
29
  memory-profiler = '^0.61.0'
27
30
  requests = '^2.31.0'
28
31
  pytest-rerunfailures = "^13.0"
32
+ python-dotenv = "^1.0.1"
33
+ rich = "^13.7.1"
29
34
 
30
35
  [build-system]
31
36
  requires = ['poetry-core']
@@ -21,4 +21,4 @@ from .data import (
21
21
  from .file import File
22
22
  from .http.endpoints import Endpoint
23
23
 
24
- __version__ = '3.6.1'
24
+ __version__ = '3.6.2'
@@ -4,8 +4,6 @@ from functools import wraps
4
4
  from io import BytesIO
5
5
  from typing import TYPE_CHECKING, Any, Callable
6
6
 
7
- from pydantic import PositiveInt
8
-
9
7
  from squarecloud import errors
10
8
 
11
9
  from .data import (
@@ -170,7 +168,7 @@ class Application(CaptureListenerManager):
170
168
  http: HTTPClient,
171
169
  id: str,
172
170
  name: str,
173
- ram: PositiveInt,
171
+ ram: int,
174
172
  lang: str,
175
173
  cluster: str,
176
174
  domain: str | None,
@@ -203,7 +201,7 @@ class Application(CaptureListenerManager):
203
201
  self._domain: str | None = domain
204
202
  self._custom: str | None = custom
205
203
  self._desc: str | None = desc
206
- self._ram: PositiveInt = ram
204
+ self._ram: int = ram
207
205
  self._lang: str = lang
208
206
  self._cluster: str = cluster
209
207
  self._client: 'Client' = client
@@ -776,5 +776,7 @@ class Client(RequestListenerManager):
776
776
 
777
777
  @_notify_listener(Endpoint.current_integration())
778
778
  async def current_app_integration(self, app_id: str) -> str | None:
779
- response: Response = await self._http.current_app_integration(app_id)
780
- return response.response
779
+ response: Response = await self._http.get_app_current_integration(
780
+ app_id
781
+ )
782
+ return response.response['webhook']
@@ -1,10 +1,13 @@
1
1
  from __future__ import annotations
2
2
 
3
3
  from datetime import datetime
4
+ from importlib.util import find_spec
4
5
  from typing import Any, Dict, Literal, Optional
5
6
 
6
- from pydantic import confloat, conint
7
- from pydantic.dataclasses import dataclass
7
+ if find_spec('pydantic'):
8
+ from pydantic.dataclasses import dataclass
9
+ else:
10
+ from dataclasses import dataclass
8
11
 
9
12
 
10
13
  @dataclass(frozen=True)
@@ -67,9 +70,9 @@ class StatusData:
67
70
  running: bool
68
71
  storage: str
69
72
  network: Dict[str, Any]
70
- requests: conint(ge=0)
71
- uptime: conint(ge=0) | None = None
72
- time: conint(ge=0) | None = None
73
+ requests: int
74
+ uptime: int | None = None
75
+ time: int | None = None
73
76
 
74
77
  def to_dict(self):
75
78
  return self.__dict__.copy()
@@ -107,7 +110,7 @@ class AppData:
107
110
  id: str
108
111
  name: str
109
112
  cluster: str
110
- ram: confloat(ge=0)
113
+ ram: float
111
114
  language: Optional[str]
112
115
  cluster: str
113
116
  domain: str | None = None
@@ -128,13 +131,13 @@ class UserData:
128
131
  :ivar plan: User plan
129
132
  :ivar email: User email
130
133
 
131
- :type id: conint(ge=0)
134
+ :type id: int
132
135
  :type name: str
133
136
  :type plan: PlanData
134
137
  :type email: str | None = None
135
138
  """
136
139
 
137
- id: conint(ge=0)
140
+ id: int
138
141
  name: str
139
142
  plan: PlanData
140
143
  email: str | None = None
@@ -253,9 +256,9 @@ class UploadData:
253
256
  id: str
254
257
  name: str
255
258
  language: Language
256
- ram: confloat(ge=0)
257
- cpu: confloat(ge=0)
258
- subdomain: str | None = None
259
+ ram: float
260
+ cpu: float
261
+ domain: str | None = None
259
262
  description: str | None = None
260
263
 
261
264
  def to_dict(self):
@@ -283,9 +286,9 @@ class FileInfo:
283
286
  app_id: str
284
287
  type: Literal['file', 'directory']
285
288
  name: str
286
- lastModified: conint(ge=0) | float
289
+ lastModified: int | float
287
290
  path: str
288
- size: confloat(ge=0.0) = 0.0
291
+ size: int = 0
289
292
 
290
293
  def to_dict(self):
291
294
  return self.__dict__.copy()
@@ -737,7 +737,7 @@ class HTTPClient:
737
737
  :raises TooManyRequestsError: Raised when the request status
738
738
  code is 429
739
739
  """
740
- route: Router = Router(Endpoint.current_webhook(), app_id=app_id)
740
+ route: Router = Router(Endpoint.current_integration(), app_id=app_id)
741
741
  response: Response = await self.request(route)
742
742
  return response
743
743
 
@@ -1,11 +1,13 @@
1
1
  import inspect
2
2
  import types
3
3
  from dataclasses import dataclass
4
+ from importlib.util import find_spec
4
5
  from types import MappingProxyType
5
6
  from typing import TYPE_CHECKING, Any, Callable, Optional, Type, Union
6
7
 
7
- import pydantic
8
- from pydantic import BaseModel
8
+ if find_spec('pydantic'):
9
+ import pydantic
10
+ from pydantic import BaseModel
9
11
 
10
12
  from .. import data, errors
11
13
  from ..http.endpoints import Endpoint
@@ -137,9 +139,9 @@ class ListenerManager:
137
139
 
138
140
  @classmethod
139
141
  def cast_to_pydantic_model(
140
- cls, model: Type[BaseModel], values: dict[Any, Any]
142
+ cls, model: Type['BaseModel'], values: dict[Any, Any]
141
143
  ):
142
- result: BaseModel | None | dict = values
144
+ result: 'BaseModel' | None | dict = values
143
145
  if isinstance(model, types.UnionType):
144
146
  for ty in model.__args__:
145
147
  if ty is None:
@@ -1,14 +1,16 @@
1
1
  import inspect
2
2
  import logging
3
3
  import types
4
+ from importlib.util import find_spec
4
5
  from typing import Any, Union
5
6
 
6
- import pydantic
7
-
8
7
  from .. import data, errors
9
8
  from ..http import Endpoint
10
9
  from . import Listener, ListenerManager
11
10
 
11
+ if find_spec('pydantic'):
12
+ import pydantic
13
+
12
14
  ListenerDataTypes = Union[
13
15
  data.AppData,
14
16
  data.StatusData,
@@ -1,9 +1,11 @@
1
1
  import inspect
2
2
  import logging
3
3
  import types
4
+ from importlib.util import find_spec
4
5
  from typing import Any
5
6
 
6
- import pydantic
7
+ if using_pydantic := find_spec('pydantic'):
8
+ import pydantic
7
9
 
8
10
  from ..http import Endpoint, Response
9
11
  from . import ListenerManager
@@ -37,6 +39,7 @@ class RequestListenerManager(ListenerManager):
37
39
  :param response: Response: Get the response from the endpoint
38
40
  :return: The result of the call function
39
41
  """
42
+ global using_pydantic
40
43
 
41
44
  def filter_annotations(annotations: list[Any]) -> Any:
42
45
  for item in annotations:
@@ -62,6 +65,7 @@ class RequestListenerManager(ListenerManager):
62
65
  call_extra_param is not None
63
66
  and annotation is not None
64
67
  and annotation != call_extra_param.empty
68
+ and using_pydantic
65
69
  ):
66
70
  annotation: Any = call_extra_param.annotation
67
71
  cast_result = self.cast_to_pydantic_model(annotation, extra)
File without changes
File without changes