Skip to main content

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

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

veikkaaja-0.1.3.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

veikkaaja-0.1.3-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file veikkaaja-0.1.3.tar.gz.

File metadata

  • Download URL: veikkaaja-0.1.3.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/58.5.3 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.9

File hashes

Hashes for veikkaaja-0.1.3.tar.gz
Algorithm Hash digest
SHA256 5409e5d7d7a4b9043a24ce2aa56782d8b8878a45ec540a7e91c4f18d951b2fe0
MD5 7567b030678a3cacdc4853a490ebc64e
BLAKE2b-256 fc919cd89dbfb789114293a7892a86ba7865d91d64b6f1e7e0ab3bd91afba6ce

See more details on using hashes here.

File details

Details for the file veikkaaja-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: veikkaaja-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/58.5.3 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.9

File hashes

Hashes for veikkaaja-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 38be99db78a9ec80956d5da9951276435b80885dfff9fd852d30199ff429e08b
MD5 b12280a14b87195fc45b91de9e05d790
BLAKE2b-256 4c04b0c6d2cb01ddb518fbbf1ab46267e2041fb76b9f7239a250b907a707c711

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page