skip to navigation
skip to content

Not Logged In 0.1.3

Python client for the Betfair API ( is a Python wrapper for the Betfair API


$ pip install


  • Python >= 2.7 or >= 3.3


To run tests

$ py.test

SSL Certificates

For non-interactive login, you must generate a self-signed SSL certificate and upload it to your Betfair account. includes tools for simplifying this process. To create a self-signed certificate, run

invoke ssl

This will generate a file named betfair.pem in the certs directory. You can write SSL certificates to another directory by passing the --name parameter

invoke ssl --name=path/to/certs/ssl

This will generate a file named ssl.pem in the path/to/certs/ directory. Once you have generated the SSL certificate, you can upload the .pem file to Betfair at


Create a Betfair client and log in

from betfair import Betfair
client = Betfair('test', 'certs/betfair.pem')
client.login('username', 'password')

Refresh session token


Log out


List all tennis markets

from betfair.models import MarketFilter
event_types = client.list_event_types(
print(len(event_types))                 # 1
print(event_types[0]   # 'Tennis'
tennis_event_type = event_types[0]
markets = client.list_market_catalogue(
markets[0].market_name                  # 'Djokovic Tournament Wins'


Joshua Carp (jmcarp)


MIT licensed. See the bundled LICENSE file for more details

File Type Py Version Uploaded on Size (md5) Source 2014-09-16 11KB
  • Downloads (All Versions):
  • 21 downloads in the last day
  • 77 downloads in the last week
  • 287 downloads in the last month