Lightweight Python wrapper for the Betfair API-NG. Provides access to Betfair's streaming and REST APIs for betting exchange operations. Current version 2.23.2, requires Python >=3.9. Released under MIT license. Active development with frequent releases.
pip install betfairlightweightVerified import paths — ran on the pinned version, not inferred.
Initialize Betfair client, login, fetch event types, and logout. Uses environment variables for credentials.
Use 'from betfairlightweight.streaming import StreamingResources' and follow the new streaming pattern.
Remove 'endpoint' from Betfair() call. Use credentials as above.
Cache the client session and call login() only once per session.
Replace imports from 'betfairlightweight.endpoints' with 'betfairlightweight.betting' or 'betfairlightweight.account'.