Fixtures¶
pychpp.fixtures.ht_datetime ¶
Datetime helpers used in pychpp.
HTDatetime ¶
HTDatetime(
season=None,
week=None,
weekday=None,
year=None,
month=None,
day=None,
hour=0,
minute=0,
second=0,
datetime=None,
league=None,
timezone=None,
)
Hattrick datetime.
Convert between a calendar datetime and the Hattrick calendar (season, week, weekday).
Initialize a HTDatetime instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
season
|
Optional[int]
|
Hattrick season (from season 1). |
None
|
week
|
Optional[int]
|
Hattrick week in the season (from 1 to 16). |
None
|
weekday
|
Optional[int]
|
Weekday in the Hattrick week (from 1 to 7). |
None
|
year
|
Optional[int]
|
Calendar year (from 1997). |
None
|
month
|
Optional[int]
|
Calendar month (from 1 to 12). |
None
|
day
|
Optional[int]
|
Calendar day in the month (from 1 to 31). |
None
|
hour
|
Hour in the day (from 0 to 23). |
0
|
|
minute
|
Minute in the hour (from 0 to 59). |
0
|
|
second
|
Second in the minute (from 0 to 59). |
0
|
|
datetime
|
Optional[datetime]
|
Date and time (from 1997-09-22 00:00). |
None
|
league
|
Optional[int | str]
|
League for which the HTDatetime is given (ID or name). |
None
|
timezone
|
Optional[str]
|
Timezone used to localize the HTDatetime. |
None
|
from_calendar
classmethod
¶
from_calendar(
year, month, day, hour=0, minute=0, second=0, **kwargs
)
Build a HTDatetime from a calendar date (year, month, day).
from_datetime
classmethod
¶
from_datetime(datetime, **kwargs)
Build a HTDatetime from a datetime object.
from_ht_calendar
classmethod
¶
from_ht_calendar(
season,
week,
weekday,
hour=0,
minute=0,
second=0,
**kwargs,
)
Build a HTDatetime from a Hattrick calendar date (season, week, weekday).
pychpp.fixtures.ht_error ¶
Exceptions raised when the CHPP API returns an error.
HTAccessDeniedError ¶
Bases: HTError
Raised when Hattrick denies access to a parameter or file (error code 1).
HTArenaNotAvailableError ¶
Bases: HTChallengeError
Raised when arena is busy.
HTChallengesNotOpenedError ¶
Bases: HTChallengeError
Raised when challenges can't be organized yet (too soon).
HTError ¶
Bases: Exception
Base Hattrick error.
HTNotOwnedTeamError ¶
Bases: HTError
Raised when the request concerns a team not owned by the connected user.
HTOpponentTeamIsTravellingError ¶
Bases: HTChallengeError
Raised when opponent team is travelling and can't be challenged.
HTOpponentTeamNotAvailableError ¶
Bases: HTChallengeError
Raised when opponent team is not available for a challenge.
HTTeamChallengingItself ¶
Bases: HTChallengeError
Raised when a team is challenging itself.
HTTeamIsTravellingError ¶
Bases: HTChallengeError
Raised when own team is travelling and can't challenge someone else.
HTTeamNotAvailableError ¶
Bases: HTChallengeError
Raised when the own team is not available for a challenge.
For example when a friendly is already booked or the team is still in cup.