Beispiel #1
0
 def getBetfairSessionToken(self,
                            betfairAppKey,
                            betfairPassword,
                            betfairUserName='******',
                            betfairAppName='alpinechickenbetfair'):
     # Byzantine betfair authentiation process
     sessionKey = bf.betfairLogin(username=betfairUserName,
                                  password=betfairPassword,
                                  appName=betfairAppName)
     self.betfairSessionKey = sessionKey
     self.betfairAppKey = betfairAppKey
Beispiel #2
0
import betfair as bf
from datetime import datetime, timedelta
## This demonstration script shows an example of loging in to the betfair API, and using some functionality within it.

## 1. Starting-up

# Login to betfair and get a session key:

username = '******'
password = '******'
sessionKey = bf.betfairLogin(username, password)
# Display returned sessionKey:
print('sessionKey = ' + sessionKey)

# The session key will need to be used to authenticate all subsequent
# API-calls during the active session.

# create an app-key for your application (this only needs to be done once
# on your betfair account, then you can retrieve the created app-key
# forever). Subsequent calls to createAppKeys will not make new keys, but
# will not return an error. I like to keep it at the start of a script so
# any new users will automatically have keys created the first time they
# run the script.
appName = 'alpinechickenbetfair'
bf.createAppKeys(sessionKey, appName)

# retrieve app keys specific to your account, which will be used to
# authenticate subsequent API calls:
liveKey, demoKey = bf.retrieveAppKeys(sessionKey)
# Display returned app-keys:
print('liveKey = ' + liveKey)