Welcome to Python Boilerplate’s documentation!¶
Contents:
Introduction¶
Python library for footy.eu website.
Version 1.0 is deprecated. Please see USAGE or Read the Docs
Installation¶
At the command line:
$ pip install footylib
Or, if you have virtualenvwrapper installed:
$ mkvirtualenv footylib
$ pip install footylib
Version 1.0¶
Deprecated
Version 2.0¶
Instantiate Footy¶
>>> from footylib import Footy
>>> footy = Footy()
Get a competition object¶
>>> competitions = footy.competitions
Search for teams¶
>>> team = footy.search_team("Hangover")
>>> team
[<footylib.footylib.Team object at 0x10dffcad0>, <footylib.footylib.Team object at 0x10e8f7250>]
Get a team object¶
>>> team = footy.get_team("Hangover 69")
Generate calendar season for a team¶
>>> team.calendar
Exporting calendar to a file¶
with open('calendar.ics', 'w') as ics:
ics.writelines(team.calendar.to_ical())
Get all attributes¶
>>> for competition in competitions:
print "Standings for {}".format(competition.name)
for team in competition.teams:
print '\t', 'Team: {}'.format(team.name)
print '\t\t', 'Position: {}'.format(team.position)
print '\t\t', 'Played games {}'.format(team.played_games)
print '\t\t', 'Won games {}'.format(team.won_games)
print '\t\t', 'Tie games {}'.format(team.tie_games)
print '\t\t', 'Lost games {}'.format(team.lost_games)
print '\t\t', 'Goals {}'.format(team.goals)
print '\t\t', 'Division {}'.format(team.division)
print '\t\t', 'Diff {}'.format(team.diff)
print '\t\t', 'Points {}'.format(team.points)
print "Calendar for {}".format(competition.name)
for match in competition.matches:
print '\t', 'Location: {}'.format(match.location)
print '\t', 'Name: {}'.format(match.title)
print '\t', 'Score: {}'.format(match.score)
print '\t', 'Referee: {}'.format(match.referee)
print '\t', 'Division: {}'.format(match.division)
print '\t', 'Date: {}'.format(match.datetime)
print '\t', 'MOTM: {}'.format(match.motm)
Contributing¶
Contributions are welcome, and they are greatly appreciated! Every little bit helps, and credit will always be given.
Submit Feedback¶
If you are proposing a feature:
- Explain in detail how it would work.
- Keep the scope as narrow as possible, to make it easier to implement.
Get Started!¶
Ready to contribute? Here’s how to set up footylib for local development.
Clone your fork locally:
$ git clone https://github.com/wefner/footy.git
Install your local copy into a virtualenv. Assuming you have virtualenvwrapper installed, this is how you set up your clone for local development:
$ mkvirtualenv footylib $ cd footylib/ $ python setup.py develop
Create a branch for local development:
$ git checkout -b name-of-your-bugfix-or-feature
Now you can make your changes locally.
Commit your changes and push your branch to the server:
$ git add . $ git commit -m "Your detailed description of your changes." $ git push origin name-of-your-bugfix-or-feature
Submit a merge request through the Github page to develop branch
footylib¶
footylib package¶
Submodules¶
footylib.footylib module¶
footylib
-
class
footylib.footylib.
Competition
(footy_instance, url)[source]¶ Bases:
object
Gets competitions from location, url and name.
Object that has all attributes for a competition
-
calendar
¶ Generates a RFC2445 (iCalendar) for all the matches in a competition :return: Calendar string
-
matches
¶ Gets all matches that are in a competition
The matches are retrieved from all the Rounds :return: list of Match objects
-
teams
¶ Gets all teams that are in a competition.
The teams are retrieved from each row in the standings table :return: list of Team objects
-
-
class
footylib.footylib.
Footy
[source]¶ Bases:
object
Main Footy class
An object that can retrieve competitions from Footy.eu or get a team directly.
-
competitions
¶ Gets all competition URLs from the league page
Returns: list of Competition objects
-
-
class
footylib.footylib.
Match
(competition_instance, match_details)[source]¶ Bases:
object
Object that has all attributes for a given match
The information is sent from Competition where it has the visibility of the Matches table. It parses every row and it gets the data per each column.
-
class
Row
(datetime, location, title, score, referee, motm)¶ Bases:
tuple
-
datetime
¶ Alias for field number 0
-
location
¶ Alias for field number 1
-
motm
¶ Alias for field number 5
-
referee
¶ Alias for field number 4
-
score
¶ Alias for field number 3
-
title
¶ Alias for field number 2
-
-
calendar
¶ Generates a RFC2445 (iCalendar) for a match :return: Calendar string
-
home_team
¶ Returns: Home team name in a match
-
home_team_goals
¶ Returns: home team goals in a match
-
visiting_team
¶ Returns: Visiting team name in a match
-
visiting_team_goals
¶ Returns: visiting team goals in a match
-
class
-
class
footylib.footylib.
Team
(competition_instance, team_details, division)[source]¶ Bases:
object
Object that has all team attributes.
The information is sent from Competition where it has the visibility of the Standings table. It parses every row and it gets the data per each column.
-
class
Row
(position, name, played_games, won_games, tie_games, lost_games, goals, diff, points)¶ Bases:
tuple
-
diff
¶ Alias for field number 7
-
goals
¶ Alias for field number 6
-
lost_games
¶ Alias for field number 5
-
name
¶ Alias for field number 1
-
played_games
¶ Alias for field number 2
-
points
¶ Alias for field number 8
-
position
¶ Alias for field number 0
-
tie_games
¶ Alias for field number 4
-
won_games
¶ Alias for field number 3
-
-
calendar
¶ Generates a RFC2445 (iCalendar) for all the Events that a Team has :return: Calendar string
-
events
¶ Returns: list of Event objects for all the matches that a Team is part of
-
matches
¶ Gets all matches for a Team :return: list of Match objects
-
class
footylib.footylibExceptions module¶
Module contents¶
Credits¶
Development Lead¶
- Oriol Fabregas <fabregas.oriol@gmail.com>
Contributors¶
- Costas Tyfoxylos <https://github.com/costastf>
History¶
0.0.1 (2016-12-16)¶
- First packaged release
2.0.7 (2017-02-14)¶
- Reverting to modify locale to change datetime
- Using dateparser module
3.0.0 (2017-09-07)¶
- Getting new HTML tags for new WordPress theme
- Removing divisions as every competition has its own URL
- Getting all Team and Matches attributes as list index
- Explicit datetime format as it confused month/day in some cases
3.0.1 (2017-09-08)¶
- Named tuples instead of lists when getting details for a Match/Team