flashpi 0.2.2__tar.gz → 0.2.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 (99) hide show
  1. {flashpi-0.2.2 → flashpi-0.2.3}/CHANGELOG.md +8 -0
  2. {flashpi-0.2.2 → flashpi-0.2.3}/PKG-INFO +17 -12
  3. {flashpi-0.2.2 → flashpi-0.2.3}/README.en.md +16 -11
  4. {flashpi-0.2.2 → flashpi-0.2.3}/README.md +16 -11
  5. {flashpi-0.2.2 → flashpi-0.2.3}/openapi/openapi.json +2 -0
  6. {flashpi-0.2.2 → flashpi-0.2.3}/pyproject.toml +1 -1
  7. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/_version.py +1 -1
  8. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/types/_generated.py +2 -0
  9. {flashpi-0.2.2 → flashpi-0.2.3}/tests/test_retries.py +10 -0
  10. {flashpi-0.2.2 → flashpi-0.2.3}/.gitignore +0 -0
  11. {flashpi-0.2.2 → flashpi-0.2.3}/LICENSE +0 -0
  12. {flashpi-0.2.2 → flashpi-0.2.3}/scripts/__init__.py +0 -0
  13. {flashpi-0.2.2 → flashpi-0.2.3}/scripts/installed_check.py +0 -0
  14. {flashpi-0.2.2 → flashpi-0.2.3}/scripts/openapi.py +0 -0
  15. {flashpi-0.2.2 → flashpi-0.2.3}/scripts/package_check.py +0 -0
  16. {flashpi-0.2.2 → flashpi-0.2.3}/scripts/readme.py +0 -0
  17. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/__init__.py +0 -0
  18. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/_client.py +0 -0
  19. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/_errors.py +0 -0
  20. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/_http.py +0 -0
  21. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/_network.py +0 -0
  22. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/_pagination.py +0 -0
  23. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/_resource.py +0 -0
  24. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/_response.py +0 -0
  25. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/_validate.py +0 -0
  26. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/_webhooks.py +0 -0
  27. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/py.typed +0 -0
  28. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/resources/__init__.py +0 -0
  29. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/resources/documents.py +0 -0
  30. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/resources/events.py +0 -0
  31. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/resources/issuer_onboardings.py +0 -0
  32. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/resources/issuers.py +0 -0
  33. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/resources/status.py +0 -0
  34. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/resources/uploads.py +0 -0
  35. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/resources/webhook_endpoints.py +0 -0
  36. {flashpi-0.2.2 → flashpi-0.2.3}/src/flashpi/types/__init__.py +0 -0
  37. {flashpi-0.2.2 → flashpi-0.2.3}/tests/__init__.py +0 -0
  38. {flashpi-0.2.2 → flashpi-0.2.3}/tests/conftest.py +0 -0
  39. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/_context.py +0 -0
  40. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/en_01.py +0 -0
  41. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/en_02.py +0 -0
  42. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/en_03.py +0 -0
  43. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/en_04.py +0 -0
  44. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/en_05.py +0 -0
  45. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/en_06.py +0 -0
  46. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/en_07.py +0 -0
  47. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/en_08.py +0 -0
  48. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/en_09.py +0 -0
  49. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/en_10.py +0 -0
  50. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/en_11.py +0 -0
  51. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/en_12.py +0 -0
  52. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/en_13.py +0 -0
  53. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/en_14.py +0 -0
  54. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/en_15.py +0 -0
  55. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/es_01.py +0 -0
  56. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/es_02.py +0 -0
  57. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/es_03.py +0 -0
  58. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/es_04.py +0 -0
  59. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/es_05.py +0 -0
  60. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/es_06.py +0 -0
  61. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/es_07.py +0 -0
  62. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/es_08.py +0 -0
  63. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/es_09.py +0 -0
  64. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/es_10.py +0 -0
  65. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/es_11.py +0 -0
  66. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/es_12.py +0 -0
  67. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/es_13.py +0 -0
  68. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/es_14.py +0 -0
  69. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/readme/es_15.py +0 -0
  70. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/typings/django/__init__.pyi +0 -0
  71. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/typings/django/http/__init__.pyi +0 -0
  72. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/typings/django/views/__init__.pyi +0 -0
  73. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/typings/django/views/decorators/__init__.pyi +0 -0
  74. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/typings/django/views/decorators/csrf.pyi +0 -0
  75. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/typings/django/views/decorators/http.pyi +0 -0
  76. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/typings/fastapi/__init__.pyi +0 -0
  77. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/typings/fastapi/responses.pyi +0 -0
  78. {flashpi-0.2.2 → flashpi-0.2.3}/tests/examples/typings/flask/__init__.pyi +0 -0
  79. {flashpi-0.2.2 → flashpi-0.2.3}/tests/live/__init__.py +0 -0
  80. {flashpi-0.2.2 → flashpi-0.2.3}/tests/live/test_live.py +0 -0
  81. {flashpi-0.2.2 → flashpi-0.2.3}/tests/support.py +0 -0
  82. {flashpi-0.2.2 → flashpi-0.2.3}/tests/test_cancellation.py +0 -0
  83. {flashpi-0.2.2 → flashpi-0.2.3}/tests/test_client.py +0 -0
  84. {flashpi-0.2.2 → flashpi-0.2.3}/tests/test_deadline.py +0 -0
  85. {flashpi-0.2.2 → flashpi-0.2.3}/tests/test_errors.py +0 -0
  86. {flashpi-0.2.2 → flashpi-0.2.3}/tests/test_headers.py +0 -0
  87. {flashpi-0.2.2 → flashpi-0.2.3}/tests/test_http.py +0 -0
  88. {flashpi-0.2.2 → flashpi-0.2.3}/tests/test_network.py +0 -0
  89. {flashpi-0.2.2 → flashpi-0.2.3}/tests/test_openapi.py +0 -0
  90. {flashpi-0.2.2 → flashpi-0.2.3}/tests/test_operations.py +0 -0
  91. {flashpi-0.2.2 → flashpi-0.2.3}/tests/test_package_check.py +0 -0
  92. {flashpi-0.2.2 → flashpi-0.2.3}/tests/test_pagination.py +0 -0
  93. {flashpi-0.2.2 → flashpi-0.2.3}/tests/test_readme.py +0 -0
  94. {flashpi-0.2.2 → flashpi-0.2.3}/tests/test_resource_types.py +0 -0
  95. {flashpi-0.2.2 → flashpi-0.2.3}/tests/test_resources.py +0 -0
  96. {flashpi-0.2.2 → flashpi-0.2.3}/tests/test_review_fixes.py +0 -0
  97. {flashpi-0.2.2 → flashpi-0.2.3}/tests/test_types.py +0 -0
  98. {flashpi-0.2.2 → flashpi-0.2.3}/tests/test_version.py +0 -0
  99. {flashpi-0.2.2 → flashpi-0.2.3}/tests/test_webhooks.py +0 -0
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.3](https://github.com/flashpi1/flashpi-python/compare/v0.2.2...v0.2.3) (2026-12-01)
4
+
5
+
6
+ ### Bug fixes
7
+
8
+ * **types:** add the billing error codes insufficient_credits and credits_frozen ([ca2209a](https://github.com/flashpi1/flashpi-python/commit/ca2209aebf5bac916fdd797f50c7a8e321496068))
9
+ * **types:** add the billing error codes insufficient_credits and credits_frozen ([137f3d8](https://github.com/flashpi1/flashpi-python/commit/137f3d85117234771ef1583bcd41e3a7e76a285f))
10
+
3
11
  ## [0.2.2](https://github.com/flashpi1/flashpi-python/compare/v0.2.1...v0.2.2) (2026-12-01)
4
12
 
5
13
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: flashpi
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: The official Python SDK for Flashpi, the electronic invoicing API for Ecuador's SRI.
5
5
  Project-URL: Homepage, https://flashpi.com.ec
6
6
  Project-URL: Documentation, https://flashpi.com.ec/docs/sdks/
@@ -210,17 +210,18 @@ except APIError as error:
210
210
  raise
211
211
  ```
212
212
 
213
- | Clase | Estado | Ejemplos de `code` |
214
- | -------------------------- | ------ | --------------------------------------------------------------------------------- |
215
- | `BadRequestError` | 400 | `malformed_json`, `invalid_idempotency_key` |
216
- | `AuthenticationError` | 401 | `authentication_required`, `invalid_api_key` |
217
- | `PermissionDeniedError` | 403 | `key_read_only`, `key_scope_mismatch`, `ip_not_allowed`, `live_key_required` |
218
- | `NotFoundError` | 404 | `not_found` |
219
- | `ConflictError` | 409 | `sequential_already_used`, `ride_not_available`, `webhook_endpoint_limit_reached` |
220
- | `UnprocessableEntityError` | 422 | `validation_failed`, `total_mismatch` |
221
- | `RateLimitError` | 429 | `demo_issuer_quota_exceeded`, `account_email_limit_reached` |
222
- | `InternalServerError` | 5xx | `internal_error` |
223
- | `APIConnectionError` | — | sin respuesta (red); `APITimeoutError` si se agotó el plazo |
213
+ | Clase | Estado | Ejemplos de `code` |
214
+ | -------------------------- | ------ | ---------------------------------------------------------------------------------------------- |
215
+ | `BadRequestError` | 400 | `malformed_json`, `invalid_idempotency_key` |
216
+ | `AuthenticationError` | 401 | `authentication_required`, `invalid_api_key` |
217
+ | `APIError` | 402 | `insufficient_credits` |
218
+ | `PermissionDeniedError` | 403 | `key_read_only`, `key_scope_mismatch`, `ip_not_allowed`, `live_key_required`, `credits_frozen` |
219
+ | `NotFoundError` | 404 | `not_found` |
220
+ | `ConflictError` | 409 | `sequential_already_used`, `ride_not_available`, `webhook_endpoint_limit_reached` |
221
+ | `UnprocessableEntityError` | 422 | `validation_failed`, `total_mismatch` |
222
+ | `RateLimitError` | 429 | `demo_issuer_quota_exceeded`, `account_email_limit_reached` |
223
+ | `InternalServerError` | 5xx | `internal_error` |
224
+ | `APIConnectionError` | — | sin respuesta (red); `APITimeoutError` si se agotó el plazo |
224
225
 
225
226
  Todas derivan de `FlashpiError`. Algunos errores traen datos extra en `error.problem`, por
226
227
  ejemplo `documentId`, `limit`, `resetsAt` o `rideStatus`. Para recibir los mensajes en español:
@@ -267,6 +268,10 @@ Una llamada de `AsyncFlashpi` cuya tarea se cancela lanza `asyncio.CancelledErro
267
268
  Los límites diarios (como la cuota del emisor demo) no se reintentan: se lanzan como
268
269
  `RateLimitError` con `retry_after` en segundos.
269
270
 
271
+ Tampoco se reintentan un 402 `insufficient_credits` (la cuenta no tiene créditos para un
272
+ documento live; los documentos de prueba siguen gratis) ni un 403 `credits_frozen` (los créditos de
273
+ la cuenta están retenidos mientras Flashpi revisa un pago; escribe a soporte@flashpi.com.ec).
274
+
270
275
  ## Webhooks
271
276
 
272
277
  Verifica cada webhook con el cuerpo **tal cual llegó** (sin parsear) y el secreto `whsec_` del
@@ -176,17 +176,18 @@ except APIError as error:
176
176
  raise
177
177
  ```
178
178
 
179
- | Class | Status | Example `code`s |
180
- | -------------------------- | ------ | --------------------------------------------------------------------------------- |
181
- | `BadRequestError` | 400 | `malformed_json`, `invalid_idempotency_key` |
182
- | `AuthenticationError` | 401 | `authentication_required`, `invalid_api_key` |
183
- | `PermissionDeniedError` | 403 | `key_read_only`, `key_scope_mismatch`, `ip_not_allowed`, `live_key_required` |
184
- | `NotFoundError` | 404 | `not_found` |
185
- | `ConflictError` | 409 | `sequential_already_used`, `ride_not_available`, `webhook_endpoint_limit_reached` |
186
- | `UnprocessableEntityError` | 422 | `validation_failed`, `total_mismatch` |
187
- | `RateLimitError` | 429 | `demo_issuer_quota_exceeded`, `account_email_limit_reached` |
188
- | `InternalServerError` | 5xx | `internal_error` |
189
- | `APIConnectionError` | — | no answer (network); `APITimeoutError` when it timed out |
179
+ | Class | Status | Example `code`s |
180
+ | -------------------------- | ------ | ---------------------------------------------------------------------------------------------- |
181
+ | `BadRequestError` | 400 | `malformed_json`, `invalid_idempotency_key` |
182
+ | `AuthenticationError` | 401 | `authentication_required`, `invalid_api_key` |
183
+ | `APIError` | 402 | `insufficient_credits` |
184
+ | `PermissionDeniedError` | 403 | `key_read_only`, `key_scope_mismatch`, `ip_not_allowed`, `live_key_required`, `credits_frozen` |
185
+ | `NotFoundError` | 404 | `not_found` |
186
+ | `ConflictError` | 409 | `sequential_already_used`, `ride_not_available`, `webhook_endpoint_limit_reached` |
187
+ | `UnprocessableEntityError` | 422 | `validation_failed`, `total_mismatch` |
188
+ | `RateLimitError` | 429 | `demo_issuer_quota_exceeded`, `account_email_limit_reached` |
189
+ | `InternalServerError` | 5xx | `internal_error` |
190
+ | `APIConnectionError` | — | no answer (network); `APITimeoutError` when it timed out |
190
191
 
191
192
  All of them derive from `FlashpiError`. Some errors carry extra members in `error.problem`, such
192
193
  as `documentId`, `limit`, `resetsAt` or `rideStatus`. For Spanish messages:
@@ -233,6 +234,10 @@ An `AsyncFlashpi` call whose task is cancelled raises `asyncio.CancelledError`,
233
234
  Daily limits (such as the demo issuer's quota) are not retried: they are raised as a
234
235
  `RateLimitError` with `retry_after` in seconds.
235
236
 
237
+ A 402 `insufficient_credits` (the account has no credits left for a live document; test
238
+ documents stay free) and a 403 `credits_frozen` (the account's credits are on hold while Flashpi
239
+ reviews a payment; contact soporte@flashpi.com.ec) are not retried either.
240
+
236
241
  ## Webhooks
237
242
 
238
243
  Verify every webhook with the body **exactly as received** (not parsed) and the endpoint's
@@ -179,17 +179,18 @@ except APIError as error:
179
179
  raise
180
180
  ```
181
181
 
182
- | Clase | Estado | Ejemplos de `code` |
183
- | -------------------------- | ------ | --------------------------------------------------------------------------------- |
184
- | `BadRequestError` | 400 | `malformed_json`, `invalid_idempotency_key` |
185
- | `AuthenticationError` | 401 | `authentication_required`, `invalid_api_key` |
186
- | `PermissionDeniedError` | 403 | `key_read_only`, `key_scope_mismatch`, `ip_not_allowed`, `live_key_required` |
187
- | `NotFoundError` | 404 | `not_found` |
188
- | `ConflictError` | 409 | `sequential_already_used`, `ride_not_available`, `webhook_endpoint_limit_reached` |
189
- | `UnprocessableEntityError` | 422 | `validation_failed`, `total_mismatch` |
190
- | `RateLimitError` | 429 | `demo_issuer_quota_exceeded`, `account_email_limit_reached` |
191
- | `InternalServerError` | 5xx | `internal_error` |
192
- | `APIConnectionError` | — | sin respuesta (red); `APITimeoutError` si se agotó el plazo |
182
+ | Clase | Estado | Ejemplos de `code` |
183
+ | -------------------------- | ------ | ---------------------------------------------------------------------------------------------- |
184
+ | `BadRequestError` | 400 | `malformed_json`, `invalid_idempotency_key` |
185
+ | `AuthenticationError` | 401 | `authentication_required`, `invalid_api_key` |
186
+ | `APIError` | 402 | `insufficient_credits` |
187
+ | `PermissionDeniedError` | 403 | `key_read_only`, `key_scope_mismatch`, `ip_not_allowed`, `live_key_required`, `credits_frozen` |
188
+ | `NotFoundError` | 404 | `not_found` |
189
+ | `ConflictError` | 409 | `sequential_already_used`, `ride_not_available`, `webhook_endpoint_limit_reached` |
190
+ | `UnprocessableEntityError` | 422 | `validation_failed`, `total_mismatch` |
191
+ | `RateLimitError` | 429 | `demo_issuer_quota_exceeded`, `account_email_limit_reached` |
192
+ | `InternalServerError` | 5xx | `internal_error` |
193
+ | `APIConnectionError` | — | sin respuesta (red); `APITimeoutError` si se agotó el plazo |
193
194
 
194
195
  Todas derivan de `FlashpiError`. Algunos errores traen datos extra en `error.problem`, por
195
196
  ejemplo `documentId`, `limit`, `resetsAt` o `rideStatus`. Para recibir los mensajes en español:
@@ -236,6 +237,10 @@ Una llamada de `AsyncFlashpi` cuya tarea se cancela lanza `asyncio.CancelledErro
236
237
  Los límites diarios (como la cuota del emisor demo) no se reintentan: se lanzan como
237
238
  `RateLimitError` con `retry_after` en segundos.
238
239
 
240
+ Tampoco se reintentan un 402 `insufficient_credits` (la cuenta no tiene créditos para un
241
+ documento live; los documentos de prueba siguen gratis) ni un 403 `credits_frozen` (los créditos de
242
+ la cuenta están retenidos mientras Flashpi revisa un pago; escribe a soporte@flashpi.com.ec).
243
+
239
244
  ## Webhooks
240
245
 
241
246
  Verifica cada webhook con el cuerpo **tal cual llegó** (sin parsear) y el secreto `whsec_` del
@@ -6449,6 +6449,8 @@
6449
6449
  "sandbox_not_enabled",
6450
6450
  "demo_issuer_quota_exceeded",
6451
6451
  "demo_issuer_unavailable",
6452
+ "insufficient_credits",
6453
+ "credits_frozen",
6452
6454
  "account_suspended"
6453
6455
  ],
6454
6456
  "description": "Stable machine-readable error code, the same in every language. Branch on it, never on `type`, `title` or `detail`. New codes may be added: handle an unknown one by its HTTP status."
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "flashpi"
3
- version = "0.2.2"
3
+ version = "0.2.3"
4
4
  description = "The official Python SDK for Flashpi, the electronic invoicing API for Ecuador's SRI."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -1,3 +1,3 @@
1
1
  """The version of this package, updated by release-please on every release."""
2
2
 
3
- VERSION = "0.2.2" # x-release-please-version
3
+ VERSION = "0.2.3" # x-release-please-version
@@ -1779,6 +1779,8 @@ ErrorCode: TypeAlias = Literal[
1779
1779
  "sandbox_not_enabled",
1780
1780
  "demo_issuer_quota_exceeded",
1781
1781
  "demo_issuer_unavailable",
1782
+ "insufficient_credits",
1783
+ "credits_frozen",
1782
1784
  "account_suspended",
1783
1785
  ]
1784
1786
  """Stable machine-readable error code, the same in every language. Branch on it, never on `type`,
@@ -45,6 +45,7 @@ class TestErrors:
45
45
  (400, "malformed_json", BadRequestError),
46
46
  (401, "invalid_api_key", AuthenticationError),
47
47
  (403, "key_read_only", PermissionDeniedError),
48
+ (403, "credits_frozen", PermissionDeniedError),
48
49
  (404, "not_found", NotFoundError),
49
50
  (409, "sequential_already_used", ConflictError),
50
51
  (413, "payload_too_large", APIError),
@@ -211,6 +212,15 @@ class TestRetries:
211
212
  await api.call("issue", {})
212
213
  assert len(api.sent) == 1
213
214
 
215
+ async def test_does_not_retry_a_402_without_credits(self, make: MakeApi) -> None:
216
+ api = make(problem(402, "insufficient_credits"))
217
+ with pytest.raises(APIError) as caught:
218
+ await api.call("issue", {})
219
+ assert type(caught.value) is APIError
220
+ assert caught.value.status == 402
221
+ assert caught.value.code == "insufficient_credits"
222
+ assert len(api.sent) == 1
223
+
214
224
  async def test_does_not_retry_a_501(self, make: MakeApi) -> None:
215
225
  api = make(httpx.Response(501))
216
226
  with pytest.raises(InternalServerError):
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes