squarecloud-api 3.5.1__tar.gz → 3.6.1__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 (22) hide show
  1. {squarecloud_api-3.5.1 → squarecloud_api-3.6.1}/LICENSE +19 -19
  2. {squarecloud_api-3.5.1 → squarecloud_api-3.6.1}/PKG-INFO +2 -4
  3. {squarecloud_api-3.5.1 → squarecloud_api-3.6.1}/pyproject.toml +3 -11
  4. {squarecloud_api-3.5.1 → squarecloud_api-3.6.1}/squarecloud/__init__.py +5 -2
  5. {squarecloud_api-3.5.1 → squarecloud_api-3.6.1}/squarecloud/app.py +28 -12
  6. {squarecloud_api-3.5.1 → squarecloud_api-3.6.1}/squarecloud/client.py +48 -5
  7. {squarecloud_api-3.5.1 → squarecloud_api-3.6.1}/squarecloud/data.py +65 -18
  8. {squarecloud_api-3.5.1 → squarecloud_api-3.6.1}/squarecloud/file.py +61 -61
  9. {squarecloud_api-3.5.1 → squarecloud_api-3.6.1}/squarecloud/http/__init__.py +2 -2
  10. {squarecloud_api-3.5.1 → squarecloud_api-3.6.1}/squarecloud/http/endpoints.py +87 -48
  11. {squarecloud_api-3.5.1 → squarecloud_api-3.6.1}/squarecloud/http/http_client.py +96 -2
  12. {squarecloud_api-3.5.1 → squarecloud_api-3.6.1}/squarecloud/listeners/__init__.py +1 -1
  13. {squarecloud_api-3.5.1 → squarecloud_api-3.6.1}/squarecloud/listeners/capture_listener.py +1 -1
  14. squarecloud_api-3.5.1/squarecloud/cli/__init__.py +0 -22
  15. squarecloud_api-3.5.1/squarecloud/cli/app.py +0 -439
  16. squarecloud_api-3.5.1/squarecloud/cli/files.py +0 -197
  17. squarecloud_api-3.5.1/squarecloud/cli/main.py +0 -172
  18. {squarecloud_api-3.5.1 → squarecloud_api-3.6.1}/README.md +0 -0
  19. {squarecloud_api-3.5.1 → squarecloud_api-3.6.1}/squarecloud/errors.py +0 -0
  20. {squarecloud_api-3.5.1 → squarecloud_api-3.6.1}/squarecloud/listeners/request_listener.py +0 -0
  21. {squarecloud_api-3.5.1 → squarecloud_api-3.6.1}/squarecloud/logging.py +0 -0
  22. {squarecloud_api-3.5.1 → squarecloud_api-3.6.1}/squarecloud/utils.py +0 -0
@@ -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,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: squarecloud-api
3
- Version: 3.5.1
3
+ Version: 3.6.1
4
4
  Summary: SquareCloud API wrapper
5
5
  Home-page: https://github.com/squarecloudofc/wrapper-api-py
6
6
  License: MIT
@@ -14,10 +14,8 @@ Classifier: Programming Language :: Python :: 3.10
14
14
  Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Programming Language :: Python :: 3.12
16
16
  Requires-Dist: aiohttp (==3.9.5)
17
- Requires-Dist: click (>=8.1.6,<9.0.0)
18
17
  Requires-Dist: pydantic (>=2.5.2,<3.0.0)
19
- Requires-Dist: python-dotenv (>=1.0.0,<2.0.0)
20
- Requires-Dist: rich (>=13.5.2,<14.0.0)
18
+ Requires-Dist: taskipy (>=1.13.0,<2.0.0)
21
19
  Project-URL: Documentation, https://docs.squarecloud.app/sdks/py
22
20
  Project-URL: Repository, https://github.com/squarecloudofc/wrapper-api-py
23
21
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = 'squarecloud-api'
3
- version = '3.5.1'
3
+ version = '3.6.1'
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,10 +12,8 @@ packages = [{ include = 'squarecloud' }]
12
12
  [tool.poetry.dependencies]
13
13
  python = '^3.9'
14
14
  aiohttp = "3.9.5"
15
- click = '^8.1.6'
16
- rich = '^13.5.2'
17
15
  pydantic = '^2.5.2'
18
- python-dotenv = '^1.0.0'
16
+ taskipy = "^1.13.0"
19
17
 
20
18
  [tool.poetry.group.dev.dependencies]
21
19
  pytest = '^7.4.3'
@@ -28,7 +26,6 @@ ruff = '^0.0.289'
28
26
  memory-profiler = '^0.61.0'
29
27
  requests = '^2.31.0'
30
28
  pytest-rerunfailures = "^13.0"
31
- taskipy = "^1.13.0"
32
29
 
33
30
  [build-system]
34
31
  requires = ['poetry-core']
@@ -53,17 +50,12 @@ line_length = 79
53
50
  [tool.taskipy.tasks]
54
51
  lint = 'isort . && blue . && ruff .'
55
52
  pre_test = 'task lint'
56
- test = 'pytest -vv -s --reruns 5 --only-rerun TooManyRequests --reruns-delay 60 -x --cov=tests tests'
53
+ test = 'pytest -vv -s --reruns 5 --only-rerun TooManyRequests --reruns-delay 90 -x --cov=tests tests'
57
54
  post_test = 'coverage html'
58
- cli = 'python -m squarecloud.cli.main'
59
55
  publish-test = 'poetry publish -r pypi-test --build'
60
56
  install-test = 'pip install -i https://test.pypi.org/pypi/ --extra-index-url https://pypi.org/simple --upgrade squarecloud-api'
61
- docs = 'mkdocs serve'
62
57
  clear-test-apps = 'python -m scripts.clear_test_apps'
63
58
 
64
- [tool.poetry.scripts]
65
- squarecloud = 'squarecloud.cli.main:safe_entry_point'
66
-
67
59
  [tool.ruff]
68
60
  line-length = 79
69
61
  exclude = ['env']
@@ -5,12 +5,15 @@ from .app import Application
5
5
  from .client import Client
6
6
  from .data import (
7
7
  AppData,
8
- BackupData,
8
+ Backup,
9
+ BackupInfo,
9
10
  DeployData,
11
+ DNSRecord,
10
12
  DomainAnalytics,
11
13
  FileInfo,
12
14
  LogsData,
13
15
  PlanData,
16
+ ResumedStatus,
14
17
  StatusData,
15
18
  UploadData,
16
19
  UserData,
@@ -18,4 +21,4 @@ from .data import (
18
21
  from .file import File
19
22
  from .http.endpoints import Endpoint
20
23
 
21
- __version__ = '3.5.1'
24
+ __version__ = '3.6.1'
@@ -10,8 +10,10 @@ from squarecloud import errors
10
10
 
11
11
  from .data import (
12
12
  AppData,
13
- BackupData,
13
+ Backup,
14
+ BackupInfo,
14
15
  DeployData,
16
+ DNSRecord,
15
17
  DomainAnalytics,
16
18
  FileInfo,
17
19
  LogsData,
@@ -46,7 +48,7 @@ class AppCache:
46
48
  """
47
49
  self._status: StatusData | None = None
48
50
  self._logs: LogsData | None = None
49
- self._backup: BackupData | None = None
51
+ self._backup: Backup | None = None
50
52
  self._app_data: AppData | None = None
51
53
 
52
54
  @property
@@ -72,13 +74,13 @@ class AppCache:
72
74
  return self._logs
73
75
 
74
76
  @property
75
- def backup(self) -> BackupData:
77
+ def backup(self) -> Backup:
76
78
  """
77
- The backup method is a property that returns the cached BackupData of
79
+ The backup method is a property that returns the cached Backup of
78
80
  the application.
79
81
 
80
82
  :return: The value of the _backup attribute
81
- :rtype: BackupData
83
+ :rtype: Backup
82
84
  """
83
85
  return self._backup
84
86
 
@@ -111,7 +113,7 @@ class AppCache:
111
113
  The update method is used to update the data of a given instance.
112
114
  It takes in an arbitrary number of arguments, and updates the
113
115
  corresponding data if it is one of the following types:
114
- StatusData, LogsData, BackupData or AppData.
116
+ StatusData, LogsData, Backup or AppData.
115
117
  If any other type is provided as an argument to this function,
116
118
  a SquareException will be raised.
117
119
 
@@ -123,7 +125,7 @@ class AppCache:
123
125
  self._status = arg
124
126
  elif isinstance(arg, LogsData):
125
127
  self._logs = arg
126
- elif isinstance(arg, BackupData):
128
+ elif isinstance(arg, Backup):
127
129
  self._backup = arg
128
130
  elif isinstance(arg, AppData):
129
131
  self._app_data = arg
@@ -133,7 +135,7 @@ class AppCache:
133
135
  for i in [
134
136
  StatusData,
135
137
  LogsData,
136
- BackupData,
138
+ Backup,
137
139
  AppData,
138
140
  ]
139
141
  ]
@@ -463,15 +465,15 @@ class Application(CaptureListenerManager):
463
465
 
464
466
  @_update_cache
465
467
  @_notify_listener(Endpoint.backup())
466
- async def backup(self, *_args, **__kwargs) -> BackupData:
468
+ async def backup(self, *_args, **__kwargs) -> Backup:
467
469
  """
468
470
  The backup function is used to create a backup of the application.
469
471
 
470
472
  :param self: Refer to the class instance
471
- :return: A BackupData object
472
- :rtype: BackupData
473
+ :return: A Backup object
474
+ :rtype: Backup
473
475
  """
474
- backup: BackupData = await self.client.backup(self.id)
476
+ backup: Backup = await self.client.backup(self.id)
475
477
  return backup
476
478
 
477
479
  async def start(self) -> Response:
@@ -647,3 +649,17 @@ class Application(CaptureListenerManager):
647
649
  self.id, custom_domain, avoid_listener=True
648
650
  )
649
651
  return response
652
+
653
+ async def all_backups(self):
654
+ backups: list[BackupInfo] = await self.client.all_app_backups(self.id)
655
+ return backups
656
+
657
+ async def move_file(self, origin: str, dest: str):
658
+ return await self.client.move_app_file(self.id, origin, dest)
659
+
660
+ async def current_integration(self):
661
+ return await self.client.current_app_integration(self.id)
662
+
663
+ @_notify_listener(Endpoint.dns_records())
664
+ async def dns_records(self) -> list[DNSRecord]:
665
+ return await self.client.dns_records(self.id)
@@ -10,11 +10,14 @@ from typing_extensions import deprecated
10
10
  from .app import Application
11
11
  from .data import (
12
12
  AppData,
13
- BackupData,
13
+ Backup,
14
+ BackupInfo,
14
15
  DeployData,
16
+ DNSRecord,
15
17
  DomainAnalytics,
16
18
  FileInfo,
17
19
  LogsData,
20
+ ResumedStatus,
18
21
  StatusData,
19
22
  UploadData,
20
23
  UserData,
@@ -329,14 +332,14 @@ class Client(RequestListenerManager):
329
332
  return await self._http.restart_application(app_id)
330
333
 
331
334
  @_notify_listener(Endpoint.backup())
332
- async def backup(self, app_id: str, **_kwargs) -> BackupData:
335
+ async def backup(self, app_id: str, **_kwargs) -> Backup:
333
336
  """
334
337
  The backup method is used to backup an application.
335
338
 
336
339
  :param app_id: Specify the application id
337
340
  :param _kwargs: Keyword arguments
338
- :return: A BackupData object
339
- :rtype: BackupData
341
+ :return: A Backup object
342
+ :rtype: Backup
340
343
 
341
344
  :raises NotFoundError: Raised when the request status code is 404
342
345
  :raises BadRequestError: Raised when the request status code is 400
@@ -347,7 +350,9 @@ class Client(RequestListenerManager):
347
350
  """
348
351
  response: Response = await self._http.backup(app_id)
349
352
  payload: dict[str, Any] = response.response
350
- return BackupData(**payload)
353
+ return Backup(**payload)
354
+
355
+ # async def app_backups(self) -> list[BackupInfo]:
351
356
 
352
357
  @_notify_listener(Endpoint.delete_app())
353
358
  async def delete_app(self, app_id: str, **_kwargs) -> Response:
@@ -734,4 +739,42 @@ class Client(RequestListenerManager):
734
739
  response: Response = await self._http.domain_analytics(
735
740
  app_id=app_id,
736
741
  )
742
+
737
743
  return DomainAnalytics(**response.response)
744
+
745
+ @_notify_listener(Endpoint.all_backups())
746
+ async def all_app_backups(
747
+ self, app_id: str, **_kwargs
748
+ ) -> list[BackupInfo]:
749
+ response: Response = await self._http.get_all_app_backups(
750
+ app_id=app_id
751
+ )
752
+ return [BackupInfo(**backup_data) for backup_data in response.response]
753
+
754
+ @_notify_listener(Endpoint.all_apps_status())
755
+ async def all_apps_status(self, **_kwargs) -> list[ResumedStatus]:
756
+ response: Response = await self._http.all_apps_status()
757
+ all_status = []
758
+ for status in response.response:
759
+ if status['running'] is True:
760
+ all_status.append(ResumedStatus(**status))
761
+ return all_status
762
+
763
+ @_notify_listener(Endpoint.move_file())
764
+ async def move_app_file(
765
+ self, app_id: str, origin: str, dest: str, **_kwargs
766
+ ) -> Response:
767
+ response: Response = await self._http.move_app_file(
768
+ app_id=app_id, origin=origin, dest=dest
769
+ )
770
+ return response
771
+
772
+ @_notify_listener(Endpoint.dns_records())
773
+ async def dns_records(self, app_id: str) -> list[DNSRecord]:
774
+ response: Response = await self._http.dns_records(app_id)
775
+ return [DNSRecord(**data) for data in response.response]
776
+
777
+ @_notify_listener(Endpoint.current_integration())
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
@@ -6,9 +6,6 @@ from typing import Any, Dict, Literal, Optional
6
6
  from pydantic import confloat, conint
7
7
  from pydantic.dataclasses import dataclass
8
8
 
9
- # pylint: disable=too-many-instance-attributes
10
- # pylint: disable=invalid-name
11
-
12
9
 
13
10
  @dataclass(frozen=True)
14
11
  class PlanData:
@@ -78,6 +75,14 @@ class StatusData:
78
75
  return self.__dict__.copy()
79
76
 
80
77
 
78
+ @dataclass(frozen=True)
79
+ class ResumedStatus:
80
+ id: str
81
+ running: bool
82
+ cpu: str
83
+ ram: str
84
+
85
+
81
86
  @dataclass(frozen=True)
82
87
  class AppData:
83
88
  """
@@ -197,16 +202,27 @@ class LogsData:
197
202
 
198
203
 
199
204
  @dataclass(frozen=True)
200
- class BackupData:
205
+ class BackupInfo:
206
+ name: str
207
+ size: int
208
+ modified: datetime
209
+ key: str
210
+
211
+
212
+ @dataclass(frozen=True)
213
+ class Backup:
201
214
  """
202
215
  Backup data class
203
216
 
204
- :ivar downloadURL: Url for download your backup
217
+ :ivar url: Url for download your backup
218
+ :ivar key: The backup's key
205
219
 
206
- :type downloadURL: str
220
+ :type url: str
221
+ :type key: str
207
222
  """
208
223
 
209
- downloadURL: str
224
+ url: str
225
+ key: str
210
226
 
211
227
  def to_dict(self):
212
228
  return self.__dict__.copy()
@@ -285,19 +301,50 @@ class DeployData:
285
301
  return self.__dict__.copy()
286
302
 
287
303
 
304
+ @dataclass(frozen=True)
305
+ class AnalyticsTotal:
306
+ visits: int
307
+ megabytes: float
308
+ bytes: int
309
+
310
+
288
311
  @dataclass(frozen=True)
289
312
  class DomainAnalytics:
290
- hostname: str
291
- total: list[Any]
292
- countries: list[Any]
293
- methods: list[Any]
294
- referers: list[Any]
295
- browsers: list[Any]
296
- deviceTypes: list[Any]
297
- operatingSystems: list[Any]
298
- agents: list[Any]
299
- hosts: list[Any]
300
- paths: list[Any]
313
+ @dataclass(frozen=True)
314
+ class Analytics:
315
+ total: list[AnalyticsTotal]
316
+ countries: list[Any]
317
+ methods: list[Any]
318
+ referers: list[Any]
319
+ browsers: list[Any]
320
+ deviceTypes: list[Any]
321
+ operatingSystems: list[Any]
322
+ agents: list[Any]
323
+ hosts: list[Any]
324
+ paths: list[Any]
325
+
326
+ def to_dict(self):
327
+ return self.__dict__.copy()
328
+
329
+ @dataclass(frozen=True)
330
+ class Domain:
331
+ hostname: str
332
+ analytics: DomainAnalytics.Analytics | None
333
+
334
+ @dataclass(frozen=True)
335
+ class Custom:
336
+ analytics: DomainAnalytics.Analytics | None
337
+
338
+ domain: Domain
339
+ custom: Custom
301
340
 
302
341
  def to_dict(self):
303
342
  return self.__dict__.copy()
343
+
344
+
345
+ @dataclass(frozen=True)
346
+ class DNSRecord:
347
+ type: str
348
+ name: str
349
+ value: str
350
+ status: str
@@ -1,61 +1,61 @@
1
- from __future__ import annotations
2
-
3
- import io
4
- import os
5
- from typing import Any
6
-
7
- from squarecloud import errors
8
-
9
-
10
- class File:
11
- """
12
- File object
13
-
14
- You can use a file already opened or pass the file path.
15
- NOTE: To pass binary data, consider usage of `io.BytesIO`.
16
- """
17
-
18
- __slots__ = ('bytes', 'filename')
19
-
20
- def __init__(
21
- self,
22
- fp: str | bytes | os.PathLike[Any] | io.BufferedIOBase,
23
- filename: str | None = None,
24
- ):
25
-
26
- """
27
- The __init__ function is called when the class is instantiated.
28
- It sets up the instance of the class, and it's where you put all your
29
- initialization code.
30
- The __init__ function takes at least one argument: self, which refers
31
- to the object being created.
32
-
33
- :param self: Refer to the class instance
34
- :param fp: str | bytes | os.PathLike[Any] | io.BufferedIOBase: Define
35
- the file path,
36
- :param filename: str | None: Set the filename attribute of the class
37
- :return: None
38
- """
39
- if isinstance(fp, io.BufferedIOBase):
40
- if not (fp.seekable() and fp.readable()):
41
- raise ValueError(
42
- f'File buffer {fp!r} must be seekable and readable'
43
- )
44
- self.bytes: io.BufferedIOBase = fp
45
- else:
46
- # Verificar se fp é bytes (dados binários) e criar um io.BytesIO
47
- if isinstance(fp, bytes):
48
- self.bytes = io.BytesIO(fp)
49
- else:
50
- self.bytes = open(fp, 'rb')
51
-
52
- if filename is None:
53
- if isinstance(fp, str):
54
- _, filename = os.path.split(fp)
55
- else:
56
- filename = getattr(fp, 'name', None)
57
-
58
- if not filename:
59
- raise errors.SquareException('You need provide a filename')
60
-
61
- self.filename: str | None = filename
1
+ from __future__ import annotations
2
+
3
+ import io
4
+ import os
5
+ from typing import Any
6
+
7
+ from squarecloud import errors
8
+
9
+
10
+ class File:
11
+ """
12
+ File object
13
+
14
+ You can use a file already opened or pass the file path.
15
+ NOTE: To pass binary data, consider usage of `io.BytesIO`.
16
+ """
17
+
18
+ __slots__ = ('bytes', 'filename')
19
+
20
+ def __init__(
21
+ self,
22
+ fp: str | bytes | os.PathLike[Any] | io.BufferedIOBase,
23
+ filename: str | None = None,
24
+ ):
25
+
26
+ """
27
+ The __init__ function is called when the class is instantiated.
28
+ It sets up the instance of the class, and it's where you put all your
29
+ initialization code.
30
+ The __init__ function takes at least one argument: self, which refers
31
+ to the object being created.
32
+
33
+ :param self: Refer to the class instance
34
+ :param fp: str | bytes | os.PathLike[Any] | io.BufferedIOBase: Define
35
+ the file path,
36
+ :param filename: str | None: Set the filename attribute of the class
37
+ :return: None
38
+ """
39
+ if isinstance(fp, io.BufferedIOBase):
40
+ if not (fp.seekable() and fp.readable()):
41
+ raise ValueError(
42
+ f'File buffer {fp!r} must be seekable and readable'
43
+ )
44
+ self.bytes: io.BufferedIOBase = fp
45
+ else:
46
+ # Verificar se fp é bytes (dados binários) e criar um io.BytesIO
47
+ if isinstance(fp, bytes):
48
+ self.bytes = io.BytesIO(fp)
49
+ else:
50
+ self.bytes = open(fp, 'rb')
51
+
52
+ if filename is None:
53
+ if isinstance(fp, str):
54
+ _, filename = os.path.split(fp)
55
+ else:
56
+ filename = getattr(fp, 'name', None)
57
+
58
+ if not filename:
59
+ raise errors.SquareException('You need provide a filename')
60
+
61
+ self.filename: str | None = filename
@@ -1,2 +1,2 @@
1
- from .endpoints import Endpoint
2
- from .http_client import HTTPClient, Response
1
+ from .endpoints import Endpoint
2
+ from .http_client import HTTPClient, Response