Skip to content

Models

Base classes

pychpp.models.ht_model

Base classes and metaclass used to build the pychpp models.

HTAliasField dataclass

HTAliasField(target)

Bases: HTBaseField

Descriptor mapping a model attribute to another attribute.

Parameters:

Name Type Description Default
target str

Name of the target attribute.

required

HTBaseField dataclass

HTBaseField()

Base dataclass for the field descriptors.

HTField dataclass

HTField(
    path,
    version=None,
    items=None,
    attrib=None,
    xml_prefix=None,
    suppl_attrs=dict(),
)

Bases: HTBaseField

Descriptor mapping a model attribute to an xml path.

Parameters:

Name Type Description Default
path str

Xml path of the data.

required
version str

Version constraint of the file in which the path exists.

None
items str

Tag of the items when the field maps to a list.

None
attrib str

Name of the xml attribute to read instead of the text.

None
xml_prefix str

Prefix added to the path.

None
suppl_attrs dict

Additional attributes used to build the path.

dict()

HTInitVar dataclass

HTInitVar(
    param, default=None, init_arg=None, fill_with=None
)

Descriptor for a request parameter of a CHPP xml file.

Parameters:

Name Type Description Default
param str

Name of the parameter in the CHPP request.

required
default Any

Default value used when the argument is not given.

None
init_arg str

Name of the init argument.

None
fill_with str

Name of the attribute filled with the value.

None

HTModel

HTModel(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Base class of every pychpp model.

Attributes are declared as class attributes using HTField, HTAliasField and HTProxyField (mapping to xml data) or HTInitVar (request parameters).

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTProxyField dataclass

HTProxyField(
    cls, attr_name=None, xml_prefix="", suppl_attrs=dict()
)

Bases: HTBaseField

Descriptor mapping a model attribute to a field of another model class.

Parameters:

Name Type Description Default
cls Type[HTModel]

Target model class.

required
attr_name str

Name of the target attribute (defaults to the attribute name).

None
xml_prefix str

Prefix added to the resolved path.

''
suppl_attrs dict

Additional attributes used to build the path.

dict()

HTVersion

HTVersion(version)

Version of a CHPP xml file, comparable with other HTVersion instances.

Parameters:

Name Type Description Default
version str

Version string, e.g. "1.7".

required

HTVersionConstraint

HTVersionConstraint(version_constraint)

Constraint on a CHPP xml file version.

Parameters:

Name Type Description Default
version_constraint str

Constraint string, e.g. "=1.7", "<=2.0", ">1.5".

required

is_valid

is_valid(ht_version)

Check if a version satisfies the constraint.

Parameters:

Name Type Description Default
ht_version HTVersion

Version to check.

required

Returns:

Type Description

True if the version satisfies the constraint.

HTXml

Gather the different methods used to parse the xml files fetched on Hattrick.

ht_bool staticmethod

ht_bool(data, attrib=None)

Return the text of an xml element as a bool.

Parameters:

Name Type Description Default
data Optional[Element]

Xml element to read.

required
attrib Optional[str]

Name of the attribute to read instead of the text.

None

ht_date_to_text staticmethod

ht_date_to_text(_datetime)

Convert a datetime object to a date string.

Parameters:

Name Type Description Default
_datetime

A datetime or HTDatetime object.

required

Returns:

Type Description

A string representing a date, e.g. "2006-02-23".

ht_datetime_from_text staticmethod

ht_datetime_from_text(data, attrib=None)

Convert a string from xml data to a HTDatetime object.

Parameters:

Name Type Description Default
data Optional[Element]

Xml data representing a date and a time.

required
attrib Optional[str]

Name of the attribute to fetch instead of the text.

None

Returns:

Type Description

A HTDatetime object.

ht_datetime_to_text staticmethod

ht_datetime_to_text(_datetime)

Convert a datetime object to a string.

Parameters:

Name Type Description Default
_datetime

A datetime or HTDatetime object.

required

Returns:

Type Description

A string representing a date and a time, e.g. "2006-02-23 20:00:00".

ht_float staticmethod

ht_float(data, attrib=None)

Return the text of an xml element as a float (comma replaced by dot).

Parameters:

Name Type Description Default
data Optional[Element]

Xml element to read.

required
attrib Optional[str]

Name of the attribute to read instead of the text.

None

ht_goals staticmethod

ht_goals(data)

Parse the goals of a match xml node.

Parameters:

Name Type Description Default
data

Xml node containing the Goal elements.

required

Returns:

Type Description

A list of dicts describing each goal.

ht_int staticmethod

ht_int(data, attrib=None)

Return the text of an xml element as an int ('Not available' becomes None).

Parameters:

Name Type Description Default
data Optional[Element]

Xml element to read.

required
attrib Optional[str]

Name of the attribute to read instead of the text.

None

ht_match_events staticmethod

ht_match_events(data)

Parse the events of a match xml node.

Parameters:

Name Type Description Default
data

Xml node containing the Event elements.

required

Returns:

Type Description

A list of dicts describing each event.

ht_str staticmethod

ht_str(data, attrib=None)

Return the text of an xml element, or one of its attributes, as a string.

Parameters:

Name Type Description Default
data Optional[Element]

Xml element to read.

required
attrib Optional[str]

Name of the attribute to read instead of the text.

None

ht_str_items staticmethod

ht_str_items(data, item_tag)

Return the texts of all the children of an xml element with the given tag.

Parameters:

Name Type Description Default
data Element

Xml element to read.

required
item_tag str

Tag of the children to read.

required

iter_data_items staticmethod

iter_data_items(data, item_tag)

Iterate over the children of an xml element with the given tag.

Parameters:

Name Type Description Default
data

Xml element to read.

required
item_tag

Tag of the children to iterate over.

required

Yields:

Type Description

The matching child elements.

opt_ht_datetime_from_text staticmethod

opt_ht_datetime_from_text(data, attrib=None)

Convert a string from xml data to a HTDatetime object, or None if empty.

Parameters:

Name Type Description Default
data Optional[Element]

Xml data representing a date and a time.

required
attrib Optional[str]

Name of the attribute to fetch instead of the text.

None

Returns:

Type Description

A HTDatetime object, or None if the data is empty or cannot be parsed.

to_string staticmethod

to_string(data)

Serialize an xml element to a string.

Parameters:

Name Type Description Default
data

Xml element to serialize.

required

MetaHTModel

Bases: type

Metaclass registering the ht_init_vars and ht_fields of each model class.

Fields and init vars declared in a class and its ancestors are gathered in the _ht_fields and _ht_init_vars class attributes.

__new__

__new__(name, bases, dict_)

Create the class and register its fields and init vars.

pychpp.models.ht_field

Dataclasses describing how model attributes map to the xml data.

HTAliasField dataclass

HTAliasField(target)

Bases: HTBaseField

Descriptor mapping a model attribute to another attribute.

Parameters:

Name Type Description Default
target str

Name of the target attribute.

required

HTBaseField dataclass

HTBaseField()

Base dataclass for the field descriptors.

HTField dataclass

HTField(
    path,
    version=None,
    items=None,
    attrib=None,
    xml_prefix=None,
    suppl_attrs=dict(),
)

Bases: HTBaseField

Descriptor mapping a model attribute to an xml path.

Parameters:

Name Type Description Default
path str

Xml path of the data.

required
version str

Version constraint of the file in which the path exists.

None
items str

Tag of the items when the field maps to a list.

None
attrib str

Name of the xml attribute to read instead of the text.

None
xml_prefix str

Prefix added to the path.

None
suppl_attrs dict

Additional attributes used to build the path.

dict()

HTProxyField dataclass

HTProxyField(
    cls, attr_name=None, xml_prefix="", suppl_attrs=dict()
)

Bases: HTBaseField

Descriptor mapping a model attribute to a field of another model class.

Parameters:

Name Type Description Default
cls Type[HTModel]

Target model class.

required
attr_name str

Name of the target attribute (defaults to the attribute name).

None
xml_prefix str

Prefix added to the resolved path.

''
suppl_attrs dict

Additional attributes used to build the path.

dict()

pychpp.models.ht_xml

Helpers to parse and format the xml data returned by the CHPP API.

HTXml

Gather the different methods used to parse the xml files fetched on Hattrick.

ht_bool staticmethod

ht_bool(data, attrib=None)

Return the text of an xml element as a bool.

Parameters:

Name Type Description Default
data Optional[Element]

Xml element to read.

required
attrib Optional[str]

Name of the attribute to read instead of the text.

None

ht_date_to_text staticmethod

ht_date_to_text(_datetime)

Convert a datetime object to a date string.

Parameters:

Name Type Description Default
_datetime

A datetime or HTDatetime object.

required

Returns:

Type Description

A string representing a date, e.g. "2006-02-23".

ht_datetime_from_text staticmethod

ht_datetime_from_text(data, attrib=None)

Convert a string from xml data to a HTDatetime object.

Parameters:

Name Type Description Default
data Optional[Element]

Xml data representing a date and a time.

required
attrib Optional[str]

Name of the attribute to fetch instead of the text.

None

Returns:

Type Description

A HTDatetime object.

ht_datetime_to_text staticmethod

ht_datetime_to_text(_datetime)

Convert a datetime object to a string.

Parameters:

Name Type Description Default
_datetime

A datetime or HTDatetime object.

required

Returns:

Type Description

A string representing a date and a time, e.g. "2006-02-23 20:00:00".

ht_float staticmethod

ht_float(data, attrib=None)

Return the text of an xml element as a float (comma replaced by dot).

Parameters:

Name Type Description Default
data Optional[Element]

Xml element to read.

required
attrib Optional[str]

Name of the attribute to read instead of the text.

None

ht_goals staticmethod

ht_goals(data)

Parse the goals of a match xml node.

Parameters:

Name Type Description Default
data

Xml node containing the Goal elements.

required

Returns:

Type Description

A list of dicts describing each goal.

ht_int staticmethod

ht_int(data, attrib=None)

Return the text of an xml element as an int ('Not available' becomes None).

Parameters:

Name Type Description Default
data Optional[Element]

Xml element to read.

required
attrib Optional[str]

Name of the attribute to read instead of the text.

None

ht_match_events staticmethod

ht_match_events(data)

Parse the events of a match xml node.

Parameters:

Name Type Description Default
data

Xml node containing the Event elements.

required

Returns:

Type Description

A list of dicts describing each event.

ht_str staticmethod

ht_str(data, attrib=None)

Return the text of an xml element, or one of its attributes, as a string.

Parameters:

Name Type Description Default
data Optional[Element]

Xml element to read.

required
attrib Optional[str]

Name of the attribute to read instead of the text.

None

ht_str_items staticmethod

ht_str_items(data, item_tag)

Return the texts of all the children of an xml element with the given tag.

Parameters:

Name Type Description Default
data Element

Xml element to read.

required
item_tag str

Tag of the children to read.

required

iter_data_items staticmethod

iter_data_items(data, item_tag)

Iterate over the children of an xml element with the given tag.

Parameters:

Name Type Description Default
data

Xml element to read.

required
item_tag

Tag of the children to iterate over.

required

Yields:

Type Description

The matching child elements.

opt_ht_datetime_from_text staticmethod

opt_ht_datetime_from_text(data, attrib=None)

Convert a string from xml data to a HTDatetime object, or None if empty.

Parameters:

Name Type Description Default
data Optional[Element]

Xml data representing a date and a time.

required
attrib Optional[str]

Name of the attribute to fetch instead of the text.

None

Returns:

Type Description

A HTDatetime object, or None if the data is empty or cannot be parsed.

to_string staticmethod

to_string(data)

Serialize an xml element to a string.

Parameters:

Name Type Description Default
data

Xml element to serialize.

required

pychpp.models.ht_init_var

Dataclass describing a request parameter of a model.

HTInitVar dataclass

HTInitVar(
    param, default=None, init_arg=None, fill_with=None
)

Descriptor for a request parameter of a CHPP xml file.

Parameters:

Name Type Description Default
param str

Name of the parameter in the CHPP request.

required
default Any

Default value used when the argument is not given.

None
init_arg str

Name of the init argument.

None
fill_with str

Name of the attribute filled with the value.

None

pychpp.models.ht_version

Version objects and constraints used to compare CHPP xml file versions.

HTVersion

HTVersion(version)

Version of a CHPP xml file, comparable with other HTVersion instances.

Parameters:

Name Type Description Default
version str

Version string, e.g. "1.7".

required

HTVersionConstraint

HTVersionConstraint(version_constraint)

Constraint on a CHPP xml file version.

Parameters:

Name Type Description Default
version_constraint str

Constraint string, e.g. "=1.7", "<=2.0", ">1.5".

required

is_valid

is_valid(ht_version)

Check if a version satisfies the constraint.

Parameters:

Name Type Description Default
ht_version HTVersion

Version to check.

required

Returns:

Type Description

True if the version satisfies the constraint.

Custom models

pychpp.models.custom.ht_team

High-level custom model built on top of the xml models.

BaseHTTeam

BaseHTTeam(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BaseCommonHTTeam

Base model for Hattrick team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTInitVar dataclass

HTInitVar(
    param, default=None, init_arg=None, fill_with=None
)

Descriptor for a request parameter of a CHPP xml file.

Parameters:

Name Type Description Default
param str

Name of the parameter in the CHPP request.

required
default Any

Default value used when the argument is not given.

None
init_arg str

Name of the init argument.

None
fill_with str

Name of the attribute filled with the value.

None

HTLightArena

HTLightArena(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BaseHTArena

Hattrick light arena.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details()

Get the full details of this arena.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTLightCountry

HTLightCountry(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BaseHTCountry

Hattrick light country.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details(**kwargs)

Get the league of this country.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTLightLeague

HTLightLeague(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BaseHTLeague

Hattrick light league.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details()

Get the details of this league.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTLightLeagueUnit

HTLightLeagueUnit(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BaseHTLeagueUnit

Hattrick light league unit.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details()

Get the details of this league unit.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTLightPlayer

HTLightPlayer(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BaseCommonHTPlayer

Base model for Hattrick light player.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details(**kwargs)

Get the full details of this player.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTLightRegion

HTLightRegion(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BaseHTRegion

Hattrick light region.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details()

Get the full details of this region.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTLightUser

HTLightUser(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BaseHTUser

Hattrick light user.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details()

Get the full details of this user.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTLightYouthTeam

HTLightYouthTeam(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BaseHTYouthTeam

Hattrick light youth team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details(**kwargs)

Get the full details of this youth team.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTProxyField dataclass

HTProxyField(
    cls, attr_name=None, xml_prefix="", suppl_attrs=dict()
)

Bases: HTBaseField

Descriptor mapping a model attribute to a field of another model class.

Parameters:

Name Type Description Default
cls Type[HTModel]

Target model class.

required
attr_name str

Name of the target attribute (defaults to the attribute name).

None
xml_prefix str

Prefix added to the resolved path.

''
suppl_attrs dict

Additional attributes used to build the path.

dict()

HTTeam

HTTeam(team_id=None, **kwargs)

Bases: RequestTeamDetails, TeamItem, BaseHTTeam

Hattrick team.

Parameters:

Name Type Description Default
team_id Optional[int]

Hattrick ID of the team. If None, the primary team is used.

None

Attributes:

Name Type Description
id int

Hattrick ID of the team.

name str

Name of the team.

user HTTeamUser

User owning the team.

arena HTTeamArena

Arena of the team.

league HTTeamLeague

League of the team.

country HTTeamCountry

Country of the team.

region HTTeamRegion

Region of the team.

league_unit HTTeamLeagueUnit

League unit of the team.

youth_team HTTeamYouthTeam

Youth team of the team.

is_bot property

is_bot

Whether the team is a bot.

url property

url

Url of this object on hattrick.org.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

players

players()

Get the players of the team.

HTTeamArena

HTTeamArena(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: HTLightArena, TeamItemArena

Arena of the team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details()

Get the full details of this arena.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTTeamCountry

HTTeamCountry(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: HTLightCountry, TeamItemCountry

Country of the team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details(**kwargs)

Get the league of this country.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTTeamLeague

HTTeamLeague(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: HTLightLeague, TeamItemLeague

League of the team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details()

Get the details of this league.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTTeamLeagueUnit

HTTeamLeagueUnit(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: HTLightLeagueUnit, TeamItemLeagueLevelUnit

League unit of the team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details()

Get the details of this league unit.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTTeamPlayers

HTTeamPlayers(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: RequestPlayers, PlayersViewTeam

Players list of a team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTTeamPlayersItem

HTTeamPlayersItem(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: HTLightPlayer, PlayersViewTeamPlayerItem

Hattrick light player for team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details(**kwargs)

Get the full details of this player.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTTeamRegion

HTTeamRegion(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: HTLightRegion, TeamItemRegion

Region of the team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details()

Get the full details of this region.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTTeamUser

HTTeamUser(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: HTLightUser, User

User owning the team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details()

Get the full details of this user.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTTeamYouthTeam

HTTeamYouthTeam(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: HTLightYouthTeam, TeamItemYouthTeam

Youth team of the team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details(**kwargs)

Get the full details of this youth team.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

PlayersViewTeam

PlayersViewTeam(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BasePlayersTeam

Players - View -> Team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

PlayersViewTeamPlayerItem

PlayersViewTeamPlayerItem(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BasePlayersTeamPlayerItem

Players - View -> Team -> Players -> Player item.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

RequestPlayers

RequestPlayers(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: HTModel

Players - Request arguments.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

pychpp.models.custom.ht_player

High-level custom model built on top of the xml models.

BaseCommonHTPlayer

BaseCommonHTPlayer(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: CustomModel

Base model for Hattrick player, youth and senior.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTAge

HTAge(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: CustomModel

Age of a player, in years and days.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

__repr__

__repr__()

HTAge representation.

__str__

__str__()

Pretty print an HTAge.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTField dataclass

HTField(
    path,
    version=None,
    items=None,
    attrib=None,
    xml_prefix=None,
    suppl_attrs=dict(),
)

Bases: HTBaseField

Descriptor mapping a model attribute to an xml path.

Parameters:

Name Type Description Default
path str

Xml path of the data.

required
version str

Version constraint of the file in which the path exists.

None
items str

Tag of the items when the field maps to a list.

None
attrib str

Name of the xml attribute to read instead of the text.

None
xml_prefix str

Prefix added to the path.

None
suppl_attrs dict

Additional attributes used to build the path.

dict()

HTPlayer

HTPlayer(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BaseCommonHTPlayer, PlayerDetails

Hattrick player.

Attributes:

Name Type Description
id int

Hattrick ID of the player.

first_name str

First name of the player.

last_name str

Last name of the player.

age HTPlayerAge

Age of the player (HTPlayerAge object).

age_years int

Age of the player, in years.

age_days int

Age of the player, in days.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTPlayerAge

HTPlayerAge(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: HTAge

Hattrick Player -> Age.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

__repr__

__repr__()

HTAge representation.

__str__

__str__()

Pretty print an HTAge.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTProxyField dataclass

HTProxyField(
    cls, attr_name=None, xml_prefix="", suppl_attrs=dict()
)

Bases: HTBaseField

Descriptor mapping a model attribute to a field of another model class.

Parameters:

Name Type Description Default
cls Type[HTModel]

Target model class.

required
attr_name str

Name of the target attribute (defaults to the attribute name).

None
xml_prefix str

Prefix added to the resolved path.

''
suppl_attrs dict

Additional attributes used to build the path.

dict()

PlayerDetails

PlayerDetails(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: RequestPlayerDetails

Player Details.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

pychpp.models.custom.ht_match

High-level custom model built on top of the xml models.

BaseHTMatch

BaseHTMatch(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: CustomModel

Base model for Hattrick match, youth and senior.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTCommonLightTeam

HTCommonLightTeam(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BaseCommonHTTeam

Base model for Hattrick light team (senior and youth).

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

is_hto property

is_hto

Whether the team is a HTO integrated team.

is_youth property

is_youth

Whether the team is a youth team.

url property

url

Url of this team on hattrick.org.

details

details(**kwargs)

Get the full details of this team (youth or senior).

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTField dataclass

HTField(
    path,
    version=None,
    items=None,
    attrib=None,
    xml_prefix=None,
    suppl_attrs=dict(),
)

Bases: HTBaseField

Descriptor mapping a model attribute to an xml path.

Parameters:

Name Type Description Default
path str

Xml path of the data.

required
version str

Version constraint of the file in which the path exists.

None
items str

Tag of the items when the field maps to a list.

None
attrib str

Name of the xml attribute to read instead of the text.

None
xml_prefix str

Prefix added to the path.

None
suppl_attrs dict

Additional attributes used to build the path.

dict()

HTMatch

HTMatch(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BaseHTMatch, RequestMatchDetails, Match

Hattrick match.

Attributes:

Name Type Description
id int

Hattrick ID of the match.

type int

Type of the match.

date datetime

Date of the match.

home_team HTMatchHomeTeam

Home team of the match.

away_team HTMatchAwayTeam

Away team of the match.

arena MatchArena

Arena where the match is played.

source_system str

Source system of the match ('senior', 'youth', ...).

goals Optional[List[MatchGoalItem]]

Goals of the match.

events Optional[List[MatchEventItem]]

Events of the match.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTMatchAwayTeam

HTMatchAwayTeam(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: HTMatchTeam, MatchAwayTeam

Away team of a match.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

is_hto property

is_hto

Whether the team is a HTO integrated team.

is_youth property

is_youth

Whether the team is a youth team.

url property

url

Url of this team on hattrick.org.

details

details(**kwargs)

Get the full details of this team (youth or senior).

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTMatchHomeTeam

HTMatchHomeTeam(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: HTMatchTeam, MatchHomeTeam

Home team of a match.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

is_hto property

is_hto

Whether the team is a HTO integrated team.

is_youth property

is_youth

Whether the team is a youth team.

url property

url

Url of this team on hattrick.org.

details

details(**kwargs)

Get the full details of this team (youth or senior).

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTMatchTeam

HTMatchTeam(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: HTCommonLightTeam

Hattrick Match -> Team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

is_hto property

is_hto

Whether the team is a HTO integrated team.

is_youth property

is_youth

Whether the team is a youth team.

url property

url

Url of this team on hattrick.org.

details

details(**kwargs)

Get the full details of this team (youth or senior).

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

Match

Match(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: HTModel

Match Details -> Match.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

MatchAwayTeam

MatchAwayTeam(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BaseMatchTeam

Match Details -> Match -> Away team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

MatchHomeTeam

MatchHomeTeam(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BaseMatchTeam

Match Details -> Match -> Home team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

RequestMatchDetails

RequestMatchDetails(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: HTModel

Match Details - Request arguments.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

pychpp.models.custom.ht_user

High-level custom model built on top of the xml models.

BaseHTUser

BaseHTUser(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: CustomModel

Base model for Hattrick user.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTLightArena

HTLightArena(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BaseHTArena

Hattrick light arena.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details()

Get the full details of this arena.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTLightLeague

HTLightLeague(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BaseHTLeague

Hattrick light league.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details()

Get the details of this league.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTLightRegion

HTLightRegion(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BaseHTRegion

Hattrick light region.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details()

Get the full details of this region.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTLightTeam

HTLightTeam(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BaseHTTeam

Hattrick light team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details()

Get the full details of this team.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTLightYouthTeam

HTLightYouthTeam(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: BaseHTYouthTeam

Hattrick light youth team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details(**kwargs)

Get the full details of this youth team.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTProxyField dataclass

HTProxyField(
    cls, attr_name=None, xml_prefix="", suppl_attrs=dict()
)

Bases: HTBaseField

Descriptor mapping a model attribute to a field of another model class.

Parameters:

Name Type Description Default
cls Type[HTModel]

Target model class.

required
attr_name str

Name of the target attribute (defaults to the attribute name).

None
xml_prefix str

Prefix added to the resolved path.

''
suppl_attrs dict

Additional attributes used to build the path.

dict()

HTUser

HTUser(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: ManagerCompendium, BaseHTUser

Hattrick user.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTUserTeam

HTUserTeam(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: TeamItem, HTLightTeam

Team of a user.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details()

Get the full details of this team.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTUserTeamArena

HTUserTeamArena(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: TeamItemArena, HTLightArena

Arena of a user's team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details()

Get the full details of this arena.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTUserTeamLeague

HTUserTeamLeague(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: TeamItemLeague, HTLightLeague

League of a user's team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details()

Get the details of this league.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTUserTeamRegion

HTUserTeamRegion(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: TeamItemRegion, HTLightRegion

Region of a user's team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details()

Get the full details of this region.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.

HTUserTeamYouthTeam

HTUserTeamYouthTeam(
    chpp,
    data=None,
    version=None,
    xml_prefix=None,
    suppl_attrs=None,
    **kwargs,
)

Bases: TeamItemYouthTeam, HTLightYouthTeam

Youth team of a user's team.

Instantiate a new HTModel object.

Parameters:

Name Type Description Default
chpp CHPPBase | CHPPXml | CHPP

A CHPP instance instantiated with credentials to connect to the CHPP API.

required
data Optional[Element]

Xml data to parse. If given, no request is sent to the CHPP API.

None
version Optional[str]

Xml file version to fetch.

None
xml_prefix Optional[str]

Default prefix added to the tag names used to parse the xml data.

None
suppl_attrs Optional[dict]

Attributes dynamically added to the instance.

None
**kwargs Any

Additional request parameters mapped to HTInitVar attributes.

{}

url property

url

Url of this object on hattrick.org.

details

details(**kwargs)

Get the full details of this youth team.

get_item_type classmethod

get_item_type(attrib)

Return the item type if the attribute's type is a list, else None.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the list items, or None if the attribute is not a list.

get_type classmethod

get_type(attrib)

Return the attribute type from its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute.

required

Returns:

Type Description
Any

The type of the attribute (None included in Optional types is stripped).

is_optional_attrib classmethod

is_optional_attrib(attrib)

Check if an attribute is optional according to its typehint.

Parameters:

Name Type Description Default
attrib str

Name of the attribute to check.

required

Returns:

Type Description
bool

True if the attribute's typehint includes None.