Ejemplo n.º 1
0
 def setUp(self):
     client = APIClient('username', 'password', 'app_key', 'UK')
     self.login = LoginInteractive(client)
Ejemplo n.º 2
0
    def test_uri(self):
        client = APIClient("bf_username", "password", "app_key")
        assert client.locale is None
        assert client.identity_uri == "https://identitysso.betfair.com/api/"
        assert client.api_uri == "https://api.betfair.com/exchange/"
        assert (
            client.navigation_uri ==
            "https://api.betfair.com/exchange/betting/rest/v1/en/navigation/menu.json"
        )
        assert client.identity_cert_uri == "https://identitysso-cert.betfair.com/api/"

        client = APIClient("bf_username",
                           "password",
                           "app_key",
                           locale="australia")
        assert client.locale == "australia"
        assert client.identity_uri == "https://identitysso.betfair.com.au/api/"
        assert client.api_uri == "https://api.betfair.com/exchange/"
        assert (
            client.navigation_uri ==
            "https://api.betfair.com/exchange/betting/rest/v1/en/navigation/menu.json"
        )
        assert client.identity_cert_uri == "https://identitysso-cert.betfair.com/api/"

        client = APIClient("bf_username",
                           "password",
                           "app_key",
                           locale="spain")
        assert client.locale == "spain"
        assert client.identity_uri == "https://identitysso.betfair.es/api/"
        assert client.api_uri == "https://api.betfair.com/exchange/"
        assert (
            client.navigation_uri ==
            "https://api.betfair.es/exchange/betting/rest/v1/es/navigation/menu.json"
        )
        assert client.identity_cert_uri == "https://identitysso-cert.betfair.es/api/"

        client = APIClient("bf_username",
                           "password",
                           "app_key",
                           locale="italy")
        assert client.locale == "italy"
        assert client.identity_uri == "https://identitysso.betfair.it/api/"
        assert client.api_uri == "https://api.betfair.com/exchange/"
        assert (
            client.navigation_uri ==
            "https://api.betfair.it/exchange/betting/rest/v1/it/navigation/menu.json"
        )
        assert client.identity_cert_uri == "https://identitysso-cert.betfair.it/api/"

        client = APIClient("bf_username",
                           "password",
                           "app_key",
                           locale="romania")
        assert client.locale == "romania"
        assert client.identity_uri == "https://identitysso.betfair.ro/api/"
        assert client.api_uri == "https://api.betfair.com/exchange/"
        assert (
            client.navigation_uri ==
            "https://api.betfair.com/exchange/betting/rest/v1/en/navigation/menu.json"
        )
        assert client.identity_cert_uri == "https://identitysso-cert.betfair.ro/api/"

        client = APIClient("bf_username",
                           "password",
                           "app_key",
                           locale="sweden")
        assert client.locale == "sweden"
        assert client.identity_uri == "https://identitysso.betfair.se/api/"
        assert client.api_uri == "https://api.betfair.com/exchange/"
        assert (
            client.navigation_uri ==
            "https://api.betfair.com/exchange/betting/rest/v1/en/navigation/menu.json"
        )
        assert client.identity_cert_uri == "https://identitysso-cert.betfair.se/api/"
Ejemplo n.º 3
0
 def setUp(self):
     client = APIClient('username', 'password', 'app_key', 'UK')
     self.base_endpoint = BaseEndpoint(client)
Ejemplo n.º 4
0
 def setUp(self):
     client = APIClient('username', 'password', 'app_key', 'UK')
     self.logout = Logout(client)
Ejemplo n.º 5
0
 def setUp(self):
     self.client = APIClient("bf_username", "password", "app_key", "/fail/")
Ejemplo n.º 6
0
 def setUp(self):
     client = APIClient('username', 'password', 'app_key', 'UK')
     self.keep_alive = KeepAlive(client)
Ejemplo n.º 7
0
 def setUp(self):
     client = APIClient('username', 'password', 'app_key', 'UK')
     self.streaming = Streaming(client)
Ejemplo n.º 8
0
 def setUp(self):
     self.client = APIClient("username", "password", "app_key", "UK")
     self.historic = Historic(self.client)
Ejemplo n.º 9
0
 def setUp(self):
     client = APIClient('username', 'password', 'app_key', 'UK')
     self.betting = Betting(client)
Ejemplo n.º 10
0
 def setUp(self):
     client = APIClient("username", "password", "app_key", "UK")
     self.betting = Betting(client)
Ejemplo n.º 11
0
 def setUp(self):
     client = APIClient('username', 'password', 'app_key', 'UK')
     self.account = Account(client)
Ejemplo n.º 12
0
 def setUp(self):
     client = APIClient("username", "password", "app_key", "UK")
     self.login = LoginInteractive(client)
Ejemplo n.º 13
0
 def setUp(self):
     client = APIClient("username", "password", "app_key", "UK")
     self.keep_alive = KeepAlive(client)
Ejemplo n.º 14
0
 def setUp(self):
     client = APIClient('username', 'password', 'app_key', 'UK')
     self.navigation = Navigation(client)
Ejemplo n.º 15
0
 def setUp(self):
     self.client = APIClient('username', 'password', 'app_key', 'UK')
     self.in_play_service = InPlayService(self.client)
Ejemplo n.º 16
0
 def setUp(self):
     client = APIClient("username", "password", "app_key", "UK")
     self.base_endpoint = BaseEndpoint(client)
Ejemplo n.º 17
0
 def setUp(self):
     self.client = APIClient('username', 'password', 'app_key', 'UK')
     self.race_card = RaceCard(self.client)
Ejemplo n.º 18
0
 def setUp(self):
     self.client = APIClient('bf_username', 'password', 'app_key', os.path.normpath('fail/'))
Ejemplo n.º 19
0
 def setUp(self):
     client = APIClient("username", "password", "app_key", "UK")
     self.navigation = Navigation(client)
Ejemplo n.º 20
0
 def setUp(self):
     self.client = APIClient('bf_username', 'password', 'app_key',
                             cert_files=normpaths(['/fail/client-2048.crt', '/fail/client-2048.key']))
Ejemplo n.º 21
0
 def test_base_endpoint_init(self):
     client = APIClient('username', 'password', 'app_key')
     streaming = Streaming(client)
     assert streaming.client == client
Ejemplo n.º 22
0
 def setUp(self):
     self.client = APIClient('bf_username', 'password', 'app_key', '/fail/')
Ejemplo n.º 23
0
 def setUp(self):
     client = APIClient("username", "password", "app_key", "UK")
     self.logout = Logout(client)
Ejemplo n.º 24
0
 def setUp(self):
     self.client = APIClient("username", "password", "app_key", "UK")
     self.streaming = Streaming(self.client)
Ejemplo n.º 25
0
 def setUp(self):
     self.client = APIClient("bf_username", "password", "app_key",
                             os.path.normpath("fail/"))
Ejemplo n.º 26
0
 def setUp(self):
     client = APIClient('username', 'password', 'app_key', 'UK')
     self.scores = Scores(client)
Ejemplo n.º 27
0
 def setUp(self):
     self.client = APIClient("username", "password", "app_key", "UK")
     self.race_card = RaceCard(self.client)
Ejemplo n.º 28
0
import datetime
import json

import requests
from betfairlightweight import APIClient
from betfairlightweight.endpoints.baseendpoint import BaseEndpoint
from betfairlightweight.filters import market_filter
from betfairlightweight.filters import price_projection, price_data, time_range
from django.utils import timezone

from .secrets import APP_KEY_DEV, APP_URL_LOGIN, USERNAME, PASSWORD, APP_CERTS_DIR

BaseEndpoint.connect_timeout = 10
BaseEndpoint.read_timeout = 30

trading = APIClient(USERNAME, PASSWORD, APP_KEY_DEV, APP_CERTS_DIR)

ET_HORSE_RACING = 7
ET_GREYHOUND_RACING = 4339


def get_betfair_client():
    if not trading.session_token:
        trading.login()
    return trading


def custom_login():
    """login to betfair"""
    # print(f'cert = {APP_CERT}')
    print(f'key = {APP_KEY_DEV}')
Ejemplo n.º 29
0
 def setUp(self):
     self.client = APIClient("username", "password", "app_key", "UK")
     self.in_play_service = InPlayService(self.client)
Ejemplo n.º 30
0
 def setUp(self):
     client = APIClient("username", "password", "app_key", "UK")
     self.scores = Scores(client)