canvas 0.33.1__py3-none-any.whl → 0.34.0__py3-none-any.whl

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 canvas might be problematic. Click here for more details.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: canvas
3
- Version: 0.33.1
3
+ Version: 0.34.0
4
4
  Summary: SDK to customize event-driven actions in your Canvas instance
5
5
  Author-email: Canvas Team <engineering@canvasmedical.com>
6
6
  License-Expression: MIT
@@ -192,7 +192,7 @@ canvas_sdk/questionnaires/utils.py,sha256=hEB9cd8LmLolrQVzxEATt4r9n2nk7wR01vjquM
192
192
  canvas_sdk/templates/__init__.py,sha256=LtUmLDsGSTq249T6sA7PUzkl2OfCAyvtIOGPNHr6wTo,83
193
193
  canvas_sdk/templates/utils.py,sha256=_AIYcGQD3ePWzQpH7ZirkV_ATtIHlzf-T_03mHoeIWI,1460
194
194
  canvas_sdk/utils/__init__.py,sha256=PADveJMf-BtOapK5Cczy-nOuZzVh-HT2H6sfJW_SK9U,198
195
- canvas_sdk/utils/http.py,sha256=T2Xwe8mv6Z_fqi1RojxMOhPoJfXK6XVQyp_1GyM8CVs,8881
195
+ canvas_sdk/utils/http.py,sha256=codq_VpnO-4j8bSP5Qud199asdO65IFkSem74DUCZrs,9556
196
196
  canvas_sdk/utils/plugins.py,sha256=b_rD1QBVaSddy5S2G-GdjD6lClKOEyQvgRpMxP1p-k8,830
197
197
  canvas_sdk/utils/stats.py,sha256=ayvr_RpMxubRWB0pJTb1semTVfE4w7onI28ESZTxgNI,2135
198
198
  canvas_sdk/v1/__init__.py,sha256=YYXr5tEQlnwMgTXJbOG963tKSPiUOM4mUkX8wuiqp7U,17
@@ -266,7 +266,7 @@ protobufs/canvas_generated/messages/plugins.proto,sha256=oNainUPWFYQjgCX7bJEPI9_
266
266
  protobufs/canvas_generated/services/plugin_runner.proto,sha256=doadBKn5k4xAtOgR-q_pEvW4yzxpUaHNOowMG6CL5GY,304
267
267
  pubsub/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
268
268
  pubsub/pubsub.py,sha256=pyTW0JU8mtaqiAV6g6xjZwel1CVy2EonPMU-_vkmhUM,1044
269
- canvas-0.33.1.dist-info/METADATA,sha256=F7sLwj1o3ZL8HWhKAOS8eakG-1r4X1r0wQzBp731zzU,4442
270
- canvas-0.33.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
271
- canvas-0.33.1.dist-info/entry_points.txt,sha256=0Vs_9GmTVUNniH6eDBlRPgofmADMV4BES6Ao26M4AbM,47
272
- canvas-0.33.1.dist-info/RECORD,,
269
+ canvas-0.34.0.dist-info/METADATA,sha256=FCJuNt-7v025Wj2Y8WznNb2306n9aWuWHPHSLisWcXE,4442
270
+ canvas-0.34.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
271
+ canvas-0.34.0.dist-info/entry_points.txt,sha256=0Vs_9GmTVUNniH6eDBlRPgofmADMV4BES6Ao26M4AbM,47
272
+ canvas-0.34.0.dist-info/RECORD,,
canvas_sdk/utils/http.py CHANGED
@@ -226,6 +226,31 @@ class Http:
226
226
  return [future.result() for future in futures]
227
227
 
228
228
 
229
+ class JsonOnlyResponse:
230
+ """
231
+ A very simple Response analog that only allows access to the json() method
232
+ and the status_code.
233
+
234
+ If we returned the response directly the user could look at the request
235
+ headers on the response object and see any authentication headers we sent
236
+ on their behalf.
237
+ """
238
+
239
+ _json: dict[str, Any] | None
240
+ status_code: int
241
+
242
+ def __init__(self, response: requests.Response):
243
+ self.status_code = response.status_code
244
+
245
+ try:
246
+ self._json = response.json()
247
+ except Exception:
248
+ self._json = None
249
+
250
+ def json(self) -> dict[str, Any] | None:
251
+ return self._json
252
+
253
+
229
254
  class JsonOnlyHttp(Http):
230
255
  def get(
231
256
  self,
@@ -238,8 +263,8 @@ class JsonOnlyHttp(Http):
238
263
  self,
239
264
  url: str,
240
265
  headers: Mapping[str, str | bytes | None] | None = None,
241
- ) -> dict[str, Any]:
242
- return super().get(url, headers).json()
266
+ ) -> JsonOnlyResponse:
267
+ return JsonOnlyResponse(super().get(url, headers))
243
268
 
244
269
  def post(
245
270
  self,