A wrapper for Veikkaus (veikkaus.fi) betting API.
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for veikkaaja-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38be99db78a9ec80956d5da9951276435b80885dfff9fd852d30199ff429e08b |
|
MD5 | b12280a14b87195fc45b91de9e05d790 |
|
BLAKE2b-256 | 4c04b0c6d2cb01ddb518fbbf1ab46267e2041fb76b9f7239a250b907a707c711 |