Pyhattrick

Python API for Hattrick

View project on GitHub

Pyhattrick

Pyhattrick is a library written in python to get Hattrick data via Hattrick API.

Quick start

  • Clone the repo: git clone https://github.com/tropiano/pyhattrick.git
  • Store your credentials in a file (for example credentials.txt) with this format:
token_key, XXX
token_secret, XXX
consumer_key, XXX
consumer_secret, XXX

Examples

Get the series id of a league given the name

import pyhattrick.pyhattrick as pyht
pyht.get_series_id_from_name("Serie A")

Get the teams of a league given the seriesid

import pyhattrick.pyhattrick as pyht
pyht.get_teams_from_series_id(724)

Get the last league match given the teamid

import pyhattrick.pyhattrick as pyht
pyht.get_last_league_match_id(1731962)

Get the team details given the teamid

import pyhattrick.pyhattrick as pyht
pyht.get_team_details_from_team_id(1914713)