Repository navigation
feat!: Python SDK 3.0.0 on the OnlineSim API v2 contract - #19
Merged
Merged
Conversation
Rewrite against the OpenAPI spec generated from the backend and the shared SDK conventions (the JS SDK is the reference): - one request function: body checked before status (456 wrong key → ApiError), NO_NUMBER → NoNumber error, validation objects → VALIDATION_ERROR - numbers, rent, user (webhook URL set/clear/logs), free.list, waitCode with injectable clock/sleep, standalone webhook parser - removed: proxy API, onlineProxy, repeat/service/serviceNumber, createEmpty, portReload, old free-number endpoints - offline tests with a fake transport, opt-in integration test (on.test) - Nuxt docs site in docs/, CI and docs workflows, CHANGELOG entry BREAKING CHANGE: new major version, see CHANGELOG.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
setup-python has no 3.9 build for the newest ubuntu-latest image. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Rewrite to the OnlineSim API v2 contract (OpenAPI generated from the backend, s00d/OnlineSIM-Backend#362). The JS SDK is the reference; all SDKs share one surface: numbers, rent, user (webhooks), free.list, waitCode, parseWebhook.
Changes (3.0.0)
A rewrite. The public API changed; see the docs.
Removed
ProxyService,Driver.proxy(), deprecated by the backend).numbers.repeat(getNumRepeat),numbers.service(getService),numbers.service_number(getServiceNumber): no backend route.rent.port_reload: deprecated no-op on the backend.user.create_empty(pay/createEmpty).free.list.Driver,APIand the per-service classes (NumbersService,RentNumbersService,UserService,FreeNumbersService),RequestException.httpx,pydantic,dacite;requirements.txt,pytest.ini,deploy.sh,DEPLOYMENT.md,example/, the live-API tests.Changed
OnlineSim(api_key, *, base_url, lang, dev_id, timeout, transport); sections are attributes (client.numbers,client.rent,client.user,client.free).Authorization: Bearer <key>, never in the query string.base_urlis the full API base (https://onlinesim.host/api/).OnlineSimError→ApiError(code,message),NoNumberError(subclass ofApiError),TransportError(status,body),TimeoutError(also a built-inTimeoutError).numbers.wait_code(tzid, *, interval, timeout, keep_open, full_message, since, sleep, clock), times in seconds.numbers.get/get_with_numbertakereject=as a keyword;get_with_numberreturns{tzid, number, country, time, service}.numbers.state(*, message_to_code, order_by, msg_list)/state_one(tzid, ...)take booleans;order_byis lowercase.rent.get(country, days, extension):extensiondefaults toTrue(the server default;Falsemakes the rent non-extendable for good).TypedDicts; money parsed to numbers (user.balance()["balance"], rentsum).urllib),py.typed, hatchling build,__version__from the installed metadata.Fixed
langwas also sent asdev_id;dev_idis sent only when set.getServicewas requested as/apigetService; old URL building is gone.NO_NUMBER/NO_NUMBER_FOR_FORWARDare mapped toNoNumberError; error messages come from the server or a fallback table.responseis stripped from successful results.getNumwas sent as POST; every call except the profile webhook update is a GET with query parameters.true/false; now1/0.rejectis a comma list; unset parameters are omitted.wait_codepolled with a broken counter; it now uses a deadline with an injectable clock.ApiError; non-JSON answers and network errors raiseTransportError.state()returns[]instead of raising when there are no operations.[](rentextend,paylist, freenumbers, countryservices) are returned as{}.pagination=0, somessagesis a flat list.pytest.iniused the[tool:pytest]header and was ignored;.venvwas not git-ignored;py.typedwas declared but missing.Added
user.set_webhook_url(url),user.clear_webhook_url(),user.webhook_logs(page).parse_webhook(payload)for inboundreceiving_sms/rent_smswebhooks.transport(HttpRequest→HttpResponse) and per-requesttimeout.Checked locally
docs/)Not published, no tag. Release steps: tag after merge, publish,
gh release create, enable GitHub Pages (gh-pages) for the docs.🤖 Generated with Claude Code