Real-time news over WebSocket - #27
Merged
Merged
Conversation
added 6 commits
June 22, 2026 14:00
…nto feature/websocket
Real-time queries can now be registered, listed, and deleted from the SDK instead of only consumed, and the two streaming consumers collapse into one class. - NewsDataApiWebSocket takes a NewsDataApiClient and adds websocket_register(), websocket_fetch(), and websocket_delete(). They go through the client's _request(), which gains a `method` argument for POST/DELETE, so they inherit its session reuse, retry/backoff, and exception mapping. Registration always targets the latest feed. - registration_id moves from the constructor to stream()/stream_async(), so a single instance can register a query and then stream it. - NewsDataApiWebSocketAsync merges into NewsDataApiWebSocket as stream_async(), and the _BaseNewsDataApiWebSocket base class is gone. Sync and async connections are tracked separately so `with` and `async with` only ever close their own socket. - Fix the stream payload field: frames carry articles under `results`, not `items`, so the consumer would have yielded nothing against the live server. Each frame is now yielded whole; malformed frames are skipped instead of ending the stream. - websockets becomes a required dependency rather than the optional `websocket` extra. It needs Python 3.10, which becomes the floor (3.8 and 3.9 are both past end of life); classifiers, the CI matrix, ruff's target-version and mypy's python_version follow. - Version 0.3.0: 0.2.3 is already published on PyPI, and the raised Python floor plus the new required dependency call for a minor bump.
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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.
What's New
websocket_fetch()andwebsocket_delete()for managing registrations.stream_async()for asyncio applications.Breaking Changes
websocketsis now a required dependency.pip install newsdataapiinstalls all required dependencies.