Hopefully this will be a painless step by step introduction in how to get stated programming the Betfair API-NG. Our chosen language of attack will be Python. Don’t worry if you have never written a line of Python code before, neither have I. You will need to have a little programming knowledge however eg I will assume you know what an IF statement is. We will be using and building upon some useful sample Python code accessible via the Betfair Developers forum. You might want to consider joining this forum at https://developer.betfair.com/

OK first things first, before we start worrying about OpenSSL and APP keys lets download and install Python

First be aware of what type of PC you are running, is it 32 bit or 64 bit. If you are in doubt go to start>computer>System Properties and check.

Step 1 Now you need to navigate in your web browser to http://www.python.org/download/

Step 2 Choose the appropriate download link eg for my 64 bit PC running windows 8 I chose ‘windows x86 – 64 MSI Installer’ and click

Step 3 The installer should download and appear at the bottom left of your screen, double click it to run the installation. Unless you have good reason not to, accept the default options when the installer is running, also answer ‘yes’ when asked if you want to allow it to update your computer. Click ‘finish’ when completed.

Step 4 Goto your c drive and locate the python34 folder. Take a look inside the ‘scripts’ folder, you will see a script called easy_install. We will be using that later to install one or two libraries that we need.

Step 5 We will use IDLE to develop Python programs so lets put it on the desktop. In Windows explorer go to c:\python34\Lib\idlelib. Copy the file idle.py and paste it to your desktop

Step 6 We will need a folder to store our python programs in. Create a folder in your area called pythonstuff or whatever name you prefer

Step 7 Double click on the IDLE desktop icon and the IDLE program should spring to life

Step 8 Click on the file tab in IDLE and select New file. A second window should appear.

Step 9 In the second window type in

print (“Hello World”)

Dont forget the brackets

Step 10 Now click RUN, you will be prompted to save the file, click OK and then navigate to your Pythonstuff folder and save with a file name of helloworld. Your program should run and the output will appear in the first IDLE window.

Well done you have written your first Python program. In the next blog we will move further towards getting Betfair data, placing bets etc through the new API

 

 

Advertisements