Repository navigation
fix: send country to states() and do not retry billed requests (0.6.2) - #16
Merged
Merged
Conversation
states() sent GET /v1/states with no country. The API requires country, so every call returned 400. states() now sends country, "US" by default. The docstring now names the engines that accept state: ChatGPT, Gemini and Bing AI Mode. The client retried a sync monitor request after a read timeout, a dropped connection, a 502 or a 504. In these cases the server can complete the first request and charge for it, so the retry can charge again. A request that is not idempotent is now retried only when the connection did not open, or on a 429, 500 or 503. An async task create is idempotent when it has an idempotency key (for a batch, when each task has one). GET requests keep all retries. The default timeout is now 320 seconds, up from 300. The server stops a sync request after 5 minutes, and the client now gets that response.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A customer reported two problems. Both are in the Python and the Node SDK.
states()sentGET /v1/stateswith nocountry. The API requirescountry(apps/api/src/controllers/v1/fetch-states.tsin backend), so every call returned 400.states()now sendscountry,"US"by default. The docstring said "Google requests". It now names the engines that acceptstate: ChatGPT, Gemini and Bing AI Mode.POST /v1/monitor/*included. The API charges a sync request when it sends a 200 (credits-middleware.ts). It checks for a client cancel only before each scrape attempt (monitor-handler.ts). Thus a retry after a client timeout can charge twice.Retry rules after this change
monitor.*, async create without a keyA 502 or 504 comes from a gateway, and the API can still complete the request and charge for it. A 429, 500 or 503 from the API did not charge.
The default timeout is now 320 s, up from 300 s. The server stops a sync request after 5 minutes, and the client now gets that response before its own timeout.
Version 0.6.2. A merge publishes it to PyPI.
Tests
states()and each retry rule. The 7 new behaviour tests fail on the old code.tsc --noEmitand the build.