weflow-sdk 0.9.2__tar.gz → 0.9.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.
Files changed (68) hide show
  1. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/PKG-INFO +1 -1
  2. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/pyproject.toml +1 -1
  3. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/__init__.py +2 -0
  4. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/client.py +36 -2
  5. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/spec.json +1 -1
  6. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/__init__.py +1 -1
  7. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/api/default_api.py +1 -1
  8. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/api_client.py +1 -1
  9. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/configuration.py +2 -2
  10. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/exceptions.py +1 -1
  11. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/__init__.py +1 -1
  12. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/account_conflict.py +1 -1
  13. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/account_deregistered.py +1 -1
  14. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/account_not_registered.py +1 -1
  15. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/account_phase.py +1 -1
  16. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/account_registered.py +1 -1
  17. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/account_state_view.py +1 -1
  18. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/account_status.py +1 -1
  19. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/account_wxid_mismatch.py +1 -1
  20. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/accounts_list.py +1 -1
  21. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/chatlab_header.py +1 -1
  22. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/chatlab_member.py +1 -1
  23. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/chatlab_message.py +1 -1
  24. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/chatlab_messages.py +1 -1
  25. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/chatlab_meta.py +1 -1
  26. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/contact.py +1 -1
  27. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/contacts.py +1 -1
  28. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/delete_api_v1_accounts_wxid200_response.py +1 -1
  29. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/event_media.py +1 -1
  30. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/event_new.py +1 -1
  31. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/event_revoke.py +1 -1
  32. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/event_sync.py +1 -1
  33. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/group_member.py +1 -1
  34. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/group_members.py +1 -1
  35. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/health.py +1 -1
  36. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/index_progress_dto.py +1 -1
  37. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/media_brief.py +1 -1
  38. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/media_envelope.py +1 -1
  39. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/media_object.py +1 -1
  40. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/message_native.py +1 -1
  41. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/messages_native.py +1 -1
  42. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/notification_frame.py +1 -1
  43. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/page.py +1 -1
  44. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/post_api_v1_accounts200_response.py +1 -1
  45. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/pull_envelope.py +1 -1
  46. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/pull_message.py +1 -1
  47. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/pull_sync.py +1 -1
  48. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/quote.py +1 -1
  49. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/session_chatlab.py +1 -1
  50. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/session_native.py +1 -1
  51. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/sessions_chatlab.py +1 -1
  52. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/sessions_native.py +1 -1
  53. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/sync_frame.py +1 -1
  54. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/sync_result.py +1 -1
  55. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/watermark_entry.py +1 -1
  56. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/models/watermark_value.py +1 -1
  57. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/rest.py +1 -1
  58. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/tests/test_behavior.py +86 -0
  59. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/.gitignore +0 -0
  60. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/LICENSE +0 -0
  61. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/README.md +0 -0
  62. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/openapitools.json +0 -0
  63. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/scripts/regen.py +0 -0
  64. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/LICENSE +0 -0
  65. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/api/__init__.py +0 -0
  66. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/api_response.py +0 -0
  67. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/generated/weflow_sdk/py.typed +0 -0
  68. {weflow_sdk-0.9.2 → weflow_sdk-0.9.3}/src/weflow_sdk/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: weflow-sdk
3
- Version: 0.9.2
3
+ Version: 0.9.3
4
4
  Summary: Typed Python client for weflow-server's HTTP API (generated models + handwritten behavior layer)
5
5
  Project-URL: Homepage, https://github.com/ren-yc/weflow-server
6
6
  Project-URL: Repository, https://github.com/ren-yc/weflow-server
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "weflow-sdk"
7
- version = "0.9.2"
7
+ version = "0.9.3"
8
8
  description = "Typed Python client for weflow-server's HTTP API (generated models + handwritten behavior layer)"
9
9
  license = "MIT"
10
10
  license-files = ["LICENSE"]
@@ -22,6 +22,7 @@ from .client import (
22
22
  StatusError,
23
23
  SyncClient,
24
24
  TransportError,
25
+ UnknownAccount,
25
26
  )
26
27
 
27
28
  __all__ = [
@@ -36,4 +37,5 @@ __all__ = [
36
37
  "StatusError",
37
38
  "SyncClient",
38
39
  "TransportError",
40
+ "UnknownAccount",
39
41
  ]
@@ -113,6 +113,24 @@ class NotReady(ClientError):
113
113
  self.last_state = last_state
114
114
 
115
115
 
116
+ class UnknownAccount(ClientError):
117
+ """``wait_ready``'s account id is not in the server's registered list.
118
+
119
+ Why fail fast: a session username (or any other identifier) passed here
120
+ used to look identical to ``not-registered`` and burn the whole timeout
121
+ before surfacing a misleading diagnosis. One successful listing that does
122
+ not contain the id is enough to know waiting cannot help.
123
+ """
124
+
125
+ def __init__(self, account: str, registered: list[str]) -> None:
126
+ shown = ", ".join(registered) if registered else "(no accounts registered)"
127
+ super().__init__(
128
+ f"account {account!r} is not in the registered list: {shown}"
129
+ )
130
+ self.account = account
131
+ self.registered = registered
132
+
133
+
116
134
  class BadDate(ClientError):
117
135
  """A time bound was neither ``YYYYMMDD`` nor unix seconds."""
118
136
 
@@ -384,7 +402,14 @@ class Client:
384
402
  else:
385
403
  last_state = str(mine.state.value)
386
404
  elif listing is not None:
387
- last_state = "not-registered"
405
+ # A listing that came through names every registered account:
406
+ # the requested id not being in it can never be fixed by
407
+ # waiting (the usual wrong input is a session username). A
408
+ # dropped round stays "not-registered" - absence of evidence
409
+ # is not evidence of absence.
410
+ raise UnknownAccount(
411
+ account, [a.wxid for a in listing.accounts]
412
+ )
388
413
  if asyncio.get_running_loop().time() >= deadline:
389
414
  # Naming the dropped rounds is the difference between "indexing, keep
390
415
  # waiting" and "this server never answered once" - both end at the
@@ -931,7 +956,16 @@ class Client:
931
956
  # errors - the two other entry points raise, so raise here too.
932
957
  raise TransportError(f"unusable base_url for SSE: {exc}") from exc
933
958
  except httpx.HTTPError as exc:
934
- log.warning("SSE stream error, reconnecting: %s", exc)
959
+ if isinstance(exc.__context__, GeneratorExit):
960
+ # Teardown of an abandoned stream (for-break, GC, task
961
+ # cancel), not a disconnect: the httpx cleanup error's
962
+ # message is empty and "reconnecting" would be a lie -
963
+ # nobody is consuming anymore. End the stream quietly;
964
+ # real disconnects keep their reconnect loop.
965
+ return
966
+ # Naming the exception type keeps the tail visible when the
967
+ # message is empty.
968
+ log.warning("SSE stream error, reconnecting: %s: %s", type(exc).__name__, exc)
935
969
  if clean_exit:
936
970
  backoff = 0.5
937
971
  await asyncio.sleep(backoff)
@@ -1386,7 +1386,7 @@
1386
1386
  },
1387
1387
  "info": {
1388
1388
  "title": "weflow-server",
1389
- "version": "0.9.2"
1389
+ "version": "0.9.3"
1390
1390
  },
1391
1391
  "openapi": "3.0.3",
1392
1392
  "paths": {
@@ -7,7 +7,7 @@
7
7
 
8
8
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
9
9
 
10
- The version of the OpenAPI document: 0.9.2
10
+ The version of the OpenAPI document: 0.9.3
11
11
  Generated by OpenAPI Generator (https://openapi-generator.tech)
12
12
 
13
13
  Do not edit the class manually.
@@ -3,7 +3,7 @@
3
3
 
4
4
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
- The version of the OpenAPI document: 0.9.2
6
+ The version of the OpenAPI document: 0.9.3
7
7
  Generated by OpenAPI Generator (https://openapi-generator.tech)
8
8
 
9
9
  Do not edit the class manually.
@@ -3,7 +3,7 @@
3
3
 
4
4
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
- The version of the OpenAPI document: 0.9.2
6
+ The version of the OpenAPI document: 0.9.3
7
7
  Generated by OpenAPI Generator (https://openapi-generator.tech)
8
8
 
9
9
  Do not edit the class manually.
@@ -3,7 +3,7 @@
3
3
 
4
4
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
- The version of the OpenAPI document: 0.9.2
6
+ The version of the OpenAPI document: 0.9.3
7
7
  Generated by OpenAPI Generator (https://openapi-generator.tech)
8
8
 
9
9
  Do not edit the class manually.
@@ -522,7 +522,7 @@ class Configuration:
522
522
  return "Python SDK Debug Report:\n"\
523
523
  "OS: {env}\n"\
524
524
  "Python Version: {pyversion}\n"\
525
- "Version of the API: 0.9.2\n"\
525
+ "Version of the API: 0.9.3\n"\
526
526
  "SDK Package Version: 1.0.0".\
527
527
  format(env=sys.platform, pyversion=sys.version)
528
528
 
@@ -3,7 +3,7 @@
3
3
 
4
4
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5
5
 
6
- The version of the OpenAPI document: 0.9.2
6
+ The version of the OpenAPI document: 0.9.3
7
7
  Generated by OpenAPI Generator (https://openapi-generator.tech)
8
8
 
9
9
  Do not edit the class manually.
@@ -6,7 +6,7 @@
6
6
 
7
7
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
8
8
 
9
- The version of the OpenAPI document: 0.9.2
9
+ The version of the OpenAPI document: 0.9.3
10
10
  Generated by OpenAPI Generator (https://openapi-generator.tech)
11
11
 
12
12
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -5,7 +5,7 @@
5
5
 
6
6
  No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
7
 
8
- The version of the OpenAPI document: 0.9.2
8
+ The version of the OpenAPI document: 0.9.3
9
9
  Generated by OpenAPI Generator (https://openapi-generator.tech)
10
10
 
11
11
  Do not edit the class manually.
@@ -25,6 +25,7 @@ from weflow_sdk import (
25
25
  StatusError,
26
26
  SyncClient,
27
27
  TransportError,
28
+ UnknownAccount,
28
29
  )
29
30
  from weflow_sdk import client as sdkmod
30
31
  from weflow_sdk.generated.weflow_sdk import models as gen
@@ -1538,3 +1539,88 @@ def test_sync_client_watch_yields_events_without_an_async_loop(monkeypatch) -> N
1538
1539
  finally:
1539
1540
  events.close()
1540
1541
  client.close()
1542
+
1543
+
1544
+ async def test_wait_ready_unknown_account_fails_fast_with_registered_ids() -> None:
1545
+ """A listing that came through without the id is a verdict, not a wait.
1546
+
1547
+ The usual wrong input is a session username, which used to surface as a
1548
+ full-timeout NotReady("last state: not-registered") - pointing the caller
1549
+ at the registration step when the real problem is which identifier was
1550
+ passed. One successful listing proves waiting cannot help.
1551
+ """
1552
+ mock = Mock()
1553
+ mock.states = ["ready"] # the listing answers; the id simply is not in it
1554
+ client = make_client(mock)
1555
+ with pytest.raises(UnknownAccount) as exc:
1556
+ await client.wait_ready("wxid_session_username_by_mistake", timeout=30)
1557
+ assert exc.value.account == "wxid_session_username_by_mistake"
1558
+ assert exc.value.registered == ["wxid_mock"]
1559
+ assert "wxid_mock" in str(exc.value), "the error names who IS registered"
1560
+ assert mock.get_accounts_calls == 1, "fail fast: exactly one poll, no burn"
1561
+ await client.aclose()
1562
+
1563
+
1564
+ def test_sync_client_wait_ready_unknown_account_fails_fast_with_registered_ids(
1565
+ monkeypatch,
1566
+ ) -> None:
1567
+ mock = Mock()
1568
+ mock.states = ["ready"]
1569
+ client = make_sync_client(mock, monkeypatch)
1570
+ try:
1571
+ with pytest.raises(UnknownAccount) as exc:
1572
+ client.wait_ready("wxid_session_username_by_mistake", timeout=30)
1573
+ finally:
1574
+ client.close()
1575
+ assert exc.value.registered == ["wxid_mock"]
1576
+ assert mock.get_accounts_calls == 1
1577
+
1578
+
1579
+ async def test_watch_close_is_silent_even_when_the_stream_errors_during_cleanup(
1580
+ caplog: pytest.LogCaptureFixture,
1581
+ ) -> None:
1582
+ """Abandoning a watch mid-stream must not log a bogus "reconnecting".
1583
+
1584
+ Closing the generator while the server response is still open makes the
1585
+ response teardown raise a transport error *inside the generator's
1586
+ cleanup*, with an empty message and a GeneratorExit context - which used
1587
+ to be logged verbatim as "SSE stream error, reconnecting: " and read
1588
+ like a real disconnect.
1589
+ """
1590
+ frame = ("\n".join(sse_frame("message.new", new_payload("9", "hi"), 7)) + "\n\n").encode()
1591
+
1592
+ class _CloseErrorsTransport(httpx.AsyncBaseTransport):
1593
+ """Serve one event, then raise a chained transport error on close."""
1594
+
1595
+ def __init__(self) -> None:
1596
+ self.connections = 0
1597
+
1598
+ async def handle_async_request(self, request: httpx.Request) -> httpx.Response:
1599
+ self.connections += 1
1600
+
1601
+ async def body():
1602
+ yield frame
1603
+ try:
1604
+ yield b""
1605
+ except GeneratorExit:
1606
+ # Closing the response mid-stream is exactly where an
1607
+ # abandoned generator surfaces its teardown error: empty
1608
+ # message, GeneratorExit as the __context__.
1609
+ raise httpx.ReadError("")
1610
+
1611
+ return httpx.Response(
1612
+ 200, headers={"content-type": "text/event-stream"}, content=body()
1613
+ )
1614
+
1615
+ transport = _CloseErrorsTransport()
1616
+ client = Client("http://mock", TOKEN)
1617
+ client._http = httpx.AsyncClient(transport=transport, base_url="http://mock")
1618
+ stream = client.watch()
1619
+ got = await asyncio.wait_for(stream.__anext__(), timeout=5)
1620
+ assert isinstance(got, gen.EventNew)
1621
+ with caplog.at_level(logging.WARNING, logger="weflow_sdk.client"):
1622
+ await stream.aclose()
1623
+ warned = [r.getMessage() for r in caplog.records]
1624
+ assert transport.connections == 1, "teardown must not reconnect"
1625
+ assert not warned, f"teardown must stay silent: {warned}"
1626
+ await client.aclose()
File without changes
File without changes
File without changes
File without changes
File without changes