Skip to content

miikama/veikkaaja

Repository files navigation

Build and Test PyPI version

Veikkaaja

Veikkaaja is a straight-forward wrapper for the Veikkaus betting API. This package is not affiliated with Veikkaus in any way, use at your own peril. An official description of the API and the entrypoints can be found at Veikkaus reference implementation

The Veikkaus API is quite extensive, endpoints for getting the game information and enabling betting are supported for the following game modes:

API Name oikea nimi implemented
MULTISCORE Moniveto -
SCORE Tulosveto -
SPORT Vakio -
WINNER Voittajavedot -
PICKTWO Päivän pari -
PICKTHREE Päivän trio -
PERFECTA Superkaksari -
TRIFECTA Supertripla -
EBET Pitkäveto 👍
RAVI Moniveikkaus -

Currently, only endpoints for EBET (Pitkäveto) are implemented in this wrapper. Contributions for the rest of the endpoints are welcome.

Installation

This package is available at PyPI. Install with pip:

pip install veikkaaja

Usage

Accessing your account

For accessing the API endpoints, you need a valid Veikkaus-account. You can provide the account information as arguments to the VeikkausClient upon initialization or as environment variables. If not provided as arguments to the client, the account information is read from the following environment variables:

export VEIKKAUS_ACCOUNT=user.name
export VEIKKAUS_PASSWORD=my-password

Betting is quite straight-forward

from veikkaaja import VeikkausClient

client = VeikkausClient('user.name', 'my-password')

Getting you account balance

client.get_balance())
0.0

Available games

Get the available games:

from veikkaaja.veikkaus_client import GameTypes

# get upcoming EBET (Pitkäveto) draws
games = client.upcoming_events(GameTypes.EBET)
print(games[0])
Game type: '12 ' 25.10.2020 02:58 : Khabib          - J.Gaethje       id: 2170768 event_id: 98816225 status: OPEN, odds: ( 131.0 - 0 -  320.0)

Placing bets

Select a game and bet:

from veikkaaja.veikkaus_client import BetTarget

# place bet on the selected game
game = games[0]
success = client.place_bet(game,
                            BetDecision(BetTarget.HOME, 100),   # The amount to bet is given in cents
                            test=True)

Veikkaus API also provides a testing endpoint, which can be used to validate your bets before actually submitting them. If you set the test=True argument in the betting function call, the testing endpoint is used instead.

Note: The testing endpoint is the default, set test=False to actually place bets.

Logging

By default, the veikkaaja API logging is quite verbose. The veikkaaja logging uses a standard library logger named veikkaaja. You can decrease the verbosity upon the package import

import veikkaaja  # or any other import from veikkaaja package

import logging
logging.getLogger('veikkaaja').setLevel(logging.WARNING)

It is also possible to increase the verbosity to show debug log messages with

export VEIKKAAJA_DEBUG=1

Contributing

I am happy if someone is interested in adding contributions to other endpoints other than EBET. To run test and install used dev-tools one should clone this repository and install the optional dependencies

git clone https://github.com/miikama/veikkaaja
cd veikkaaja
pip install -e .[dev]

See description of our testing approach in testing

About

A Python wrapper for Veikkaus (veikkaus.fi) betting API

Resources

License

Stars

Watchers

Forks

Packages

No packages published