soia-client 1.1.2__tar.gz → 1.1.3__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.

Potentially problematic release.


This version of soia-client might be problematic. Click here for more details.

Files changed (34) hide show
  1. {soia_client-1.1.2 → soia_client-1.1.3}/PKG-INFO +1 -1
  2. {soia_client-1.1.2 → soia_client-1.1.3}/pyproject.toml +1 -1
  3. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_impl/service.py +29 -2
  4. {soia_client-1.1.2 → soia_client-1.1.3}/soia_client.egg-info/PKG-INFO +1 -1
  5. {soia_client-1.1.2 → soia_client-1.1.3}/LICENSE +0 -0
  6. {soia_client-1.1.2 → soia_client-1.1.3}/README.md +0 -0
  7. {soia_client-1.1.2 → soia_client-1.1.3}/setup.cfg +0 -0
  8. {soia_client-1.1.2 → soia_client-1.1.3}/soia/__init__.py +0 -0
  9. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_impl/__init__.py +0 -0
  10. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_impl/arrays.py +0 -0
  11. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_impl/enums.py +0 -0
  12. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_impl/function_maker.py +0 -0
  13. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_impl/keep.py +0 -0
  14. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_impl/keyed_items.py +0 -0
  15. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_impl/method.py +0 -0
  16. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_impl/never.py +0 -0
  17. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_impl/optionals.py +0 -0
  18. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_impl/primitives.py +0 -0
  19. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_impl/repr.py +0 -0
  20. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_impl/serializer.py +0 -0
  21. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_impl/serializers.py +0 -0
  22. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_impl/service_client.py +0 -0
  23. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_impl/structs.py +0 -0
  24. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_impl/timestamp.py +0 -0
  25. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_impl/type_adapter.py +0 -0
  26. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_module_initializer.py +0 -0
  27. {soia_client-1.1.2 → soia_client-1.1.3}/soia/_spec.py +0 -0
  28. {soia_client-1.1.2 → soia_client-1.1.3}/soia/reflection.py +0 -0
  29. {soia_client-1.1.2 → soia_client-1.1.3}/soia_client.egg-info/SOURCES.txt +0 -0
  30. {soia_client-1.1.2 → soia_client-1.1.3}/soia_client.egg-info/dependency_links.txt +0 -0
  31. {soia_client-1.1.2 → soia_client-1.1.3}/soia_client.egg-info/top_level.txt +0 -0
  32. {soia_client-1.1.2 → soia_client-1.1.3}/tests/test_module_initializer.py +0 -0
  33. {soia_client-1.1.2 → soia_client-1.1.3}/tests/test_serializers.py +0 -0
  34. {soia_client-1.1.2 → soia_client-1.1.3}/tests/test_timestamp.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: soia-client
3
- Version: 1.1.2
3
+ Version: 1.1.3
4
4
  Author-email: Tyler Fibonacci <gepheum@gmail.com>
5
5
  License: MIT License
6
6
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "soia-client"
7
- version = "1.1.2"
7
+ version = "1.1.3"
8
8
  description = ""
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Tyler Fibonacci", email = "gepheum@gmail.com" }]
@@ -26,29 +26,50 @@ class _MethodImpl(Generic[Request, Response, RequestHeaders, ResponseHeaders]):
26
26
  @dataclass(frozen=True)
27
27
  class RawServiceResponse:
28
28
  data: str
29
- type: Literal["ok-json", "bad-request", "server-error"]
29
+ type: Literal["ok-json", "ok-html", "bad-request", "server-error"]
30
30
 
31
31
  @property
32
32
  def status_code(self):
33
- if self.type == "ok-json":
33
+ if self.type == "ok-json" or self.type == "ok-html":
34
34
  return 200
35
35
  elif self.type == "bad-request":
36
36
  return 400
37
37
  elif self.type == "server-error":
38
38
  return 500
39
39
  else:
40
+ _: Never = self.type
40
41
  raise TypeError(f"Unknown response type: {self.type}")
41
42
 
42
43
  @property
43
44
  def content_type(self):
44
45
  if self.type == "ok-json":
45
46
  return "application/json"
47
+ if self.type == "ok-html":
48
+ return "text/html; charset=utf-8"
46
49
  elif self.type == "bad-request" or self.type == "server-error":
47
50
  return "text/plain; charset=utf-8"
48
51
  else:
52
+ _: Never = self.type
49
53
  raise TypeError(f"Unknown response type: {self.type}")
50
54
 
51
55
 
56
+ # Copied from
57
+ # https://github.com/gepheum/restudio/blob/main/index.jsdeliver.html
58
+ _RESTUDIO_HTML = """<!DOCTYPE html>
59
+
60
+ <html>
61
+ <head>
62
+ <meta charset="utf-8" />
63
+ <title>RESTudio</title>
64
+ <script src="dist/restudio-standalone.js"></script>
65
+ </head>
66
+ <body style="margin: 0; padding: 0;">
67
+ <restudio-app></restudio-app>
68
+ </body>
69
+ </html>
70
+ """
71
+
72
+
52
73
  @dataclass()
53
74
  class _HandleRequestFlow(Generic[Request, Response, RequestHeaders, ResponseHeaders]):
54
75
  req_body: str
@@ -94,6 +115,9 @@ class _HandleRequestFlow(Generic[Request, Response, RequestHeaders, ResponseHead
94
115
  if self.req_body in ["", "list"]:
95
116
  return self._handle_list()
96
117
 
118
+ if self.req_body == "restudio":
119
+ return self._handle_restudio()
120
+
97
121
  # Method invokation
98
122
  method_name: str
99
123
  method_number: int | None
@@ -211,6 +235,9 @@ class _HandleRequestFlow(Generic[Request, Response, RequestHeaders, ResponseHead
211
235
  )
212
236
  return RawServiceResponse(json_code, "ok-json")
213
237
 
238
+ def _handle_restudio(self) -> RawServiceResponse:
239
+ return RawServiceResponse(_RESTUDIO_HTML, "ok-html")
240
+
214
241
  def _response_to_json(
215
242
  self,
216
243
  res: Response,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: soia-client
3
- Version: 1.1.2
3
+ Version: 1.1.3
4
4
  Author-email: Tyler Fibonacci <gepheum@gmail.com>
5
5
  License: MIT License
6
6
 
File without changes
File without changes
File without changes
File without changes