pychpp 0.4.5__tar.gz → 0.4.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pychpp-0.4.5 → pychpp-0.4.6}/PKG-INFO +6 -3
- {pychpp-0.4.5 → pychpp-0.4.6}/README.md +5 -2
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/chpp.py +73 -3
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/ht_model.py +6 -4
- pychpp-0.4.6/pychpp/models/xml/match_orders.py +178 -0
- pychpp-0.4.6/pychpp/models/xml/national_players.py +89 -0
- pychpp-0.4.6/pychpp/models/xml/national_team_matches.py +49 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pyproject.toml +1 -1
- {pychpp-0.4.5 → pychpp-0.4.6}/LICENSE +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/__init__.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/fixtures/__init__.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/fixtures/ht_datetime.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/fixtures/ht_error.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/__init__.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/__init__.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/base/__init__.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/base/ht_arena.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/base/ht_country.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/base/ht_league.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/base/ht_league_unit.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/base/ht_match.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/base/ht_player.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/base/ht_region.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/base/ht_team.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/base/ht_user.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/ht_arena.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/ht_challenge.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/ht_league.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/ht_league_unit.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/ht_match.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/ht_match_lineup.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/ht_matches_archive.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/ht_player.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/ht_region.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/ht_team.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/ht_transfer_history.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/ht_user.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/ht_youth_player.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/custom/ht_youth_team.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/ht_field.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/ht_init_var.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/ht_version.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/ht_xml.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/__init__.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/achievements.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/alliance_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/alliances.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/arena_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/avatars.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/bookmarks.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/challenges.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/club.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/cup_matches.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/current_bids.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/economy.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/fans.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/hof_players.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/ladder_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/ladder_list.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/league_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/league_fixtures.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/league_levels.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/live.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/manager_compendium.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/match_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/match_lineup.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/matches.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/matches_archive.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/national_team_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/national_teams.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/player_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/players.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/region_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/team_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/training.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/transfers_team.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/world_cup.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/world_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/youth_player_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/youth_player_list.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.6}/pychpp/models/xml/youth_team_details.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: pychpp
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.6
|
|
4
4
|
Summary: framework created to use the API provided by the online game Hattrick
|
|
5
5
|
Home-page: https://framagit.org/Pierre86/pychpp
|
|
6
6
|
License: Apache-2.0
|
|
@@ -165,7 +165,7 @@ Then, to use this new class:
|
|
|
165
165
|
In this way, only the data you're really interested in is parsed, which can in some cases be interesting from a performance point of view.
|
|
166
166
|
|
|
167
167
|
## List of supported CHPP XML files
|
|
168
|
-

|
|
169
169
|
|
|
170
170
|
The following table shows the CHPP XML files that are currently supported:
|
|
171
171
|
|
|
@@ -193,10 +193,13 @@ The following table shows the CHPP XML files that are currently supported:
|
|
|
193
193
|
| ManagerCompendium | `managercompendium.xml` |
|
|
194
194
|
| MatchDetails | `matchdetails.xml` |
|
|
195
195
|
| MatchLineup | `matchlineup.xml` |
|
|
196
|
+
| MatchOrders | `matchorders.xml` |
|
|
196
197
|
| MatchesArchive | `matchesarchive.xml` |
|
|
197
|
-
| Matches |
|
|
198
|
+
| Matches | `matches.xml` |
|
|
198
199
|
| NationalTeamDetails | `nationalteamdetails.xml` |
|
|
200
|
+
| NationalTeamMatches | `nationalteammatches.xml` |
|
|
199
201
|
| NationalTeams | `nationalteams.xml` |
|
|
202
|
+
| NationalPlayers | `nationalplayers.xml` |
|
|
200
203
|
| PlayerDetails | `playerdetails.xml` |
|
|
201
204
|
| Players | `players.xml` |
|
|
202
205
|
| RegionDetails | `regiondetails.xml` |
|
|
@@ -143,7 +143,7 @@ Then, to use this new class:
|
|
|
143
143
|
In this way, only the data you're really interested in is parsed, which can in some cases be interesting from a performance point of view.
|
|
144
144
|
|
|
145
145
|
## List of supported CHPP XML files
|
|
146
|
-

|
|
147
147
|
|
|
148
148
|
The following table shows the CHPP XML files that are currently supported:
|
|
149
149
|
|
|
@@ -171,10 +171,13 @@ The following table shows the CHPP XML files that are currently supported:
|
|
|
171
171
|
| ManagerCompendium | `managercompendium.xml` |
|
|
172
172
|
| MatchDetails | `matchdetails.xml` |
|
|
173
173
|
| MatchLineup | `matchlineup.xml` |
|
|
174
|
+
| MatchOrders | `matchorders.xml` |
|
|
174
175
|
| MatchesArchive | `matchesarchive.xml` |
|
|
175
|
-
| Matches |
|
|
176
|
+
| Matches | `matches.xml` |
|
|
176
177
|
| NationalTeamDetails | `nationalteamdetails.xml` |
|
|
178
|
+
| NationalTeamMatches | `nationalteammatches.xml` |
|
|
177
179
|
| NationalTeams | `nationalteams.xml` |
|
|
180
|
+
| NationalPlayers | `nationalplayers.xml` |
|
|
178
181
|
| PlayerDetails | `playerdetails.xml` |
|
|
179
182
|
| Players | `players.xml` |
|
|
180
183
|
| RegionDetails | `regiondetails.xml` |
|
|
@@ -14,7 +14,7 @@ from pychpp.models.xml import (manager_compendium, team_details, achievements, a
|
|
|
14
14
|
matches_archive, match_details, cup_matches, alliances,
|
|
15
15
|
alliance_details, avatars, bookmarks, club, current_bids, economy,
|
|
16
16
|
fans, hof_players, ladder_details, ladder_list, league_levels, live,
|
|
17
|
-
matches)
|
|
17
|
+
matches, match_orders, national_team_matches, national_players)
|
|
18
18
|
from pychpp.models.custom import (ht_team, ht_arena, ht_user, ht_region, ht_youth_team, ht_player,
|
|
19
19
|
ht_league_unit, ht_youth_player, ht_league, ht_matches_archive,
|
|
20
20
|
ht_match, ht_challenge, ht_match_lineup, ht_transfer_history)
|
|
@@ -273,7 +273,7 @@ class CHPPBase:
|
|
|
273
273
|
)
|
|
274
274
|
|
|
275
275
|
def _base_request(
|
|
276
|
-
self, url, parse_data=True, **kwargs,
|
|
276
|
+
self, url, parse_data=True, method='GET', **kwargs,
|
|
277
277
|
) -> xml.etree.ElementTree:
|
|
278
278
|
"""
|
|
279
279
|
Base method for sending a request via the CHPP API
|
|
@@ -283,7 +283,14 @@ class CHPPBase:
|
|
|
283
283
|
:return: xml data fetched on Hattrick
|
|
284
284
|
"""
|
|
285
285
|
session = self.open_session()
|
|
286
|
-
|
|
286
|
+
|
|
287
|
+
if method == 'GET':
|
|
288
|
+
query = session.get(url, params=kwargs)
|
|
289
|
+
elif method == 'POST':
|
|
290
|
+
query = session.post(url, data=kwargs)
|
|
291
|
+
else:
|
|
292
|
+
raise ValueError(f"Unknown method '{method}'")
|
|
293
|
+
|
|
287
294
|
query.encoding = "UTF-8"
|
|
288
295
|
self.last_url = query.url
|
|
289
296
|
|
|
@@ -683,6 +690,39 @@ class CHPPXml(CHPPBase):
|
|
|
683
690
|
source_system=source_system, **kwargs,
|
|
684
691
|
)
|
|
685
692
|
|
|
693
|
+
def xml_match_orders(
|
|
694
|
+
self, match_id: int, action_type: str = 'view', team_id: int = None,
|
|
695
|
+
source_system: str = 'Hattrick', lineup: str = None, **kwargs,
|
|
696
|
+
) -> Union[match_orders.MatchOrdersView,
|
|
697
|
+
match_orders.MatchOrdersSetMatchOrder,
|
|
698
|
+
match_orders.MatchOrdersPredictRatings,
|
|
699
|
+
]:
|
|
700
|
+
|
|
701
|
+
if action_type == 'view':
|
|
702
|
+
return match_orders.MatchOrdersView(
|
|
703
|
+
chpp=self, action_type=action_type, match_id=match_id,
|
|
704
|
+
team_id=team_id, source_system=source_system, lineup=lineup,
|
|
705
|
+
**kwargs,
|
|
706
|
+
)
|
|
707
|
+
|
|
708
|
+
elif action_type == 'setmatchorder':
|
|
709
|
+
return match_orders.MatchOrdersSetMatchOrder(
|
|
710
|
+
chpp=self, action_type=action_type, match_id=match_id,
|
|
711
|
+
team_id=team_id, source_system=source_system, lineup=lineup,
|
|
712
|
+
**kwargs,
|
|
713
|
+
)
|
|
714
|
+
|
|
715
|
+
elif action_type == 'predictratings':
|
|
716
|
+
return match_orders.MatchOrdersPredictRatings(
|
|
717
|
+
chpp=self, action_type=action_type, match_id=match_id,
|
|
718
|
+
team_id=team_id, source_system=source_system, lineup=lineup,
|
|
719
|
+
**kwargs,
|
|
720
|
+
)
|
|
721
|
+
|
|
722
|
+
else:
|
|
723
|
+
raise ValueError("if set, 'action_type' must be equal to"
|
|
724
|
+
"'view', 'setmatchorder' or 'predictratings'")
|
|
725
|
+
|
|
686
726
|
def xml_matches(
|
|
687
727
|
self, team_id: int = None, is_youth: bool = None, **kwargs,
|
|
688
728
|
) -> matches.Matches:
|
|
@@ -719,6 +759,36 @@ class CHPPXml(CHPPBase):
|
|
|
719
759
|
chpp=self, team_id=team_id, **kwargs,
|
|
720
760
|
)
|
|
721
761
|
|
|
762
|
+
def xml_national_team_matches(
|
|
763
|
+
self, league_office_type_id: int = None, **kwargs,
|
|
764
|
+
) -> national_team_matches.NationalTeamMatches:
|
|
765
|
+
|
|
766
|
+
return national_team_matches.NationalTeamMatches(
|
|
767
|
+
chpp=self, league_office_type_id=league_office_type_id, **kwargs,
|
|
768
|
+
)
|
|
769
|
+
|
|
770
|
+
def xml_national_players(
|
|
771
|
+
self, team_id: int, action_type: str = 'view', match_type_category: int = None,
|
|
772
|
+
show_all: bool = None, **kwargs,
|
|
773
|
+
) -> Union[national_players.NationalPlayersView,
|
|
774
|
+
national_players.NationalPlayersStats,
|
|
775
|
+
]:
|
|
776
|
+
|
|
777
|
+
if action_type == 'view':
|
|
778
|
+
return national_players.NationalPlayersView(
|
|
779
|
+
chpp=self, action_type=action_type, team_id=team_id, **kwargs,
|
|
780
|
+
)
|
|
781
|
+
|
|
782
|
+
elif action_type == 'SupporterStats':
|
|
783
|
+
return national_players.NationalPlayersStats(
|
|
784
|
+
chpp=self, action_type=action_type, team_id=team_id,
|
|
785
|
+
match_type_category=match_type_category, show_all=show_all, **kwargs,
|
|
786
|
+
)
|
|
787
|
+
|
|
788
|
+
else:
|
|
789
|
+
raise ValueError("if set, 'action_type' must be equal to"
|
|
790
|
+
"'view', 'setmatchorder' or 'SupporterStats'")
|
|
791
|
+
|
|
722
792
|
def xml_players(self, action_type: str = 'view', order_by: str = None,
|
|
723
793
|
team_id: int = None, include_match_info: bool = None, **kwargs,
|
|
724
794
|
) -> Union[players.PlayersView,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import pathlib
|
|
2
2
|
from copy import copy
|
|
3
|
-
from typing import Optional, Type, Dict, Any
|
|
3
|
+
from typing import Optional, Type, Dict, Any
|
|
4
4
|
import xml.etree.ElementTree as ElementTree
|
|
5
5
|
from datetime import datetime, date
|
|
6
6
|
from typing import get_type_hints, get_origin, Union, get_args
|
|
@@ -43,7 +43,8 @@ class MetaHTModel(type):
|
|
|
43
43
|
|
|
44
44
|
class HTModel(metaclass=MetaHTModel):
|
|
45
45
|
|
|
46
|
-
SOURCE_FILE:
|
|
46
|
+
SOURCE_FILE: str
|
|
47
|
+
METHOD: str = 'GET'
|
|
47
48
|
LAST_VERSION: str
|
|
48
49
|
URL_PATH: Optional[str] = None
|
|
49
50
|
XML_PREFIX: str = ''
|
|
@@ -144,12 +145,12 @@ class HTModel(metaclass=MetaHTModel):
|
|
|
144
145
|
|
|
145
146
|
# if data is None, fetch data on Hattrick
|
|
146
147
|
if self._data is None:
|
|
147
|
-
self._fetch(
|
|
148
|
+
self._fetch(**kwargs)
|
|
148
149
|
|
|
149
150
|
# Once data is obtained, transform HTField to actual values
|
|
150
151
|
self._transform_fields()
|
|
151
152
|
|
|
152
|
-
def _fetch(self,
|
|
153
|
+
def _fetch(self, **kwargs):
|
|
153
154
|
|
|
154
155
|
# data is fetched using ht_init_vars attribute as query parameters
|
|
155
156
|
for attr, ht_init_var in self._ht_init_vars.items():
|
|
@@ -179,6 +180,7 @@ class HTModel(metaclass=MetaHTModel):
|
|
|
179
180
|
|
|
180
181
|
# self._data is filled with the file returned by the API call
|
|
181
182
|
self._data = self._chpp.request(file=self.SOURCE_FILE,
|
|
183
|
+
method=self.METHOD,
|
|
182
184
|
version=self.version.as_string,
|
|
183
185
|
**self._requests_args,
|
|
184
186
|
)
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from typing import Optional, List
|
|
3
|
+
|
|
4
|
+
from pychpp.models.ht_field import HTField
|
|
5
|
+
from pychpp.models.ht_init_var import HTInitVar
|
|
6
|
+
from pychpp.models.ht_model import HTModel
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class RequestMatchOrders(HTModel):
|
|
10
|
+
"""
|
|
11
|
+
Match Orders - Request arguments
|
|
12
|
+
"""
|
|
13
|
+
SOURCE_FILE = 'matchorders'
|
|
14
|
+
LAST_VERSION = '3.1'
|
|
15
|
+
|
|
16
|
+
_r_action_type: Optional[str] = HTInitVar('actionType', init_arg='action_type')
|
|
17
|
+
_r_match_id: int = HTInitVar('matchID', init_arg='match_id')
|
|
18
|
+
_r_team_id: Optional[int] = HTInitVar('teamid', init_arg='team_id')
|
|
19
|
+
_r_source_system: Optional[str] = HTInitVar('sourceSystem', init_arg='source_system')
|
|
20
|
+
_r_lineup: Optional[str] = HTInitVar('lineup', init_arg='lineup')
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class CommonMatchOrders(RequestMatchOrders):
|
|
24
|
+
"""
|
|
25
|
+
Match Orders
|
|
26
|
+
"""
|
|
27
|
+
id: int = HTField('MatchID')
|
|
28
|
+
source_system: str = HTField('SourceSystem')
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class MatchOrdersView(CommonMatchOrders):
|
|
32
|
+
"""
|
|
33
|
+
Match Orders - View
|
|
34
|
+
"""
|
|
35
|
+
match_data: Optional['MatchDataView'] = HTField('MatchData')
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class MatchDataView(HTModel):
|
|
39
|
+
"""
|
|
40
|
+
Match Orders - View -> Match Data
|
|
41
|
+
"""
|
|
42
|
+
available: bool = HTField('.', attrib='Available')
|
|
43
|
+
home_team: 'Team' = HTField('HomeTeam', xml_prefix='Home')
|
|
44
|
+
away_team: 'Team' = HTField('AwayTeam', xml_prefix='Away')
|
|
45
|
+
arena: 'Arena' = HTField('Arena')
|
|
46
|
+
date: datetime = HTField('MatchDate')
|
|
47
|
+
type: int = HTField('MatchType')
|
|
48
|
+
attitude: Optional[int] = HTField('Attitude')
|
|
49
|
+
tactic_type: int = HTField('TacticType')
|
|
50
|
+
coach_modifier: Optional[int] = HTField('CoachModifier')
|
|
51
|
+
lineup: 'Lineup' = HTField('Lineup')
|
|
52
|
+
player_orders: List['PlayerOrderItem'] = HTField('PlayerOrders', items='PlayerOrder')
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class Team(HTModel):
|
|
56
|
+
"""
|
|
57
|
+
Match Orders - View -> Match Data -> Home/Away Team
|
|
58
|
+
"""
|
|
59
|
+
id: int = HTField('TeamID')
|
|
60
|
+
name: str = HTField('TeamName')
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class Arena(HTModel):
|
|
64
|
+
"""
|
|
65
|
+
Match Orders - View -> Match Data -> Arena
|
|
66
|
+
"""
|
|
67
|
+
id: int = HTField('ArenaID')
|
|
68
|
+
name: str = HTField('ArenaName')
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class Lineup(HTModel):
|
|
72
|
+
"""
|
|
73
|
+
Match Orders - View -> Match Data -> Lineup
|
|
74
|
+
"""
|
|
75
|
+
positions: List['PositionPlayerItem'] = HTField('Positions', items='Player')
|
|
76
|
+
bench: List['BenchPlayerItem'] = HTField('Bench', items='Player')
|
|
77
|
+
kickers: List['KickerPlayerItem'] = HTField('Kickers', items='Player')
|
|
78
|
+
set_pieces: Optional['SetPieces'] = HTField('SetPieces')
|
|
79
|
+
captain: Optional['Captain'] = HTField('Captain')
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class BasePlayer(HTModel):
|
|
83
|
+
"""
|
|
84
|
+
Match Orders - View -> Match Data -> Lineup -> Base player
|
|
85
|
+
"""
|
|
86
|
+
id: int = HTField('PlayerID')
|
|
87
|
+
first_name: str = HTField('FirstName')
|
|
88
|
+
nick_name: str = HTField('NickName')
|
|
89
|
+
last_name: str = HTField('LastName')
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class PositionPlayerItem(BasePlayer):
|
|
93
|
+
"""
|
|
94
|
+
Match Orders - View -> Match Data -> Lineup -> Positions -> Player item
|
|
95
|
+
"""
|
|
96
|
+
role_id: int = HTField('RoleID')
|
|
97
|
+
behaviour: int = HTField('Behaviour')
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
class BenchPlayerItem(BasePlayer):
|
|
101
|
+
"""
|
|
102
|
+
Match Orders - View -> Match Data -> Lineup -> Bench -> Player item
|
|
103
|
+
"""
|
|
104
|
+
role_id: int = HTField('RoleID')
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
class KickerPlayerItem(HTModel):
|
|
108
|
+
"""
|
|
109
|
+
Match Orders - View -> Match Data -> Lineup -> Kickers -> Player item
|
|
110
|
+
"""
|
|
111
|
+
id: int = HTField('PlayerID')
|
|
112
|
+
role_id: int = HTField('RoleID')
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
class SetPieces(BasePlayer):
|
|
116
|
+
"""
|
|
117
|
+
Match Orders - View -> Match Data -> Lineup -> Set Pieces
|
|
118
|
+
"""
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class Captain(BasePlayer):
|
|
122
|
+
"""
|
|
123
|
+
Match Orders - View -> Match Data -> Lineup -> Captain
|
|
124
|
+
"""
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
class PlayerOrderItem(HTModel):
|
|
128
|
+
"""
|
|
129
|
+
Match Orders - View -> Match Data -> Player Orders -> Player order item
|
|
130
|
+
"""
|
|
131
|
+
id: int = HTField('PlayerOrderID')
|
|
132
|
+
match_minute_criteria: int = HTField('MatchMinuteCriteria')
|
|
133
|
+
goal_diff_criteria: int = HTField('GoalDiffCriteria')
|
|
134
|
+
red_card_criteria: int = HTField('RedCardCriteria')
|
|
135
|
+
subject_player_id: int = HTField('SubjectPlayerID')
|
|
136
|
+
object_player_id: int = HTField('ObjectPlayerID')
|
|
137
|
+
order_type: int = HTField('OrderType')
|
|
138
|
+
new_position_id: int = HTField('NewPositionId')
|
|
139
|
+
new_position_behaviour: int = HTField('NewPositionBehaviour')
|
|
140
|
+
extra_integer: int = HTField('PlayerOrderExtraInteger')
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
class MatchOrdersSetMatchOrder(CommonMatchOrders):
|
|
144
|
+
"""
|
|
145
|
+
Match Orders - Set match order
|
|
146
|
+
"""
|
|
147
|
+
METHOD = 'POST'
|
|
148
|
+
match_data: Optional['MatchDataSetMatchOrder'] = HTField('MatchData')
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
class MatchDataSetMatchOrder(HTModel):
|
|
152
|
+
"""
|
|
153
|
+
Match Orders - Set match order -> Match Data
|
|
154
|
+
"""
|
|
155
|
+
orders_set: bool = HTField('.', attrib='OrdersSet')
|
|
156
|
+
reason: Optional[str] = HTField('Reason')
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
class MatchOrdersPredictRatings(CommonMatchOrders):
|
|
160
|
+
"""
|
|
161
|
+
Match Orders - Predict Ratings
|
|
162
|
+
"""
|
|
163
|
+
match_data: Optional['MatchDataPredictRatings'] = HTField('MatchData')
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
class MatchDataPredictRatings(HTModel):
|
|
167
|
+
"""
|
|
168
|
+
Match Orders - Predict Ratings -> Match Data
|
|
169
|
+
"""
|
|
170
|
+
tactic_type: int = HTField('TacticType')
|
|
171
|
+
tactic_skill: int = HTField('TacticSkill')
|
|
172
|
+
rating_midfield: int = HTField('RatingMidfield')
|
|
173
|
+
rating_right_def: int = HTField('RatingRightDef')
|
|
174
|
+
rating_mid_def: int = HTField('RatingMidDef')
|
|
175
|
+
rating_left_def: int = HTField('RatingLeftDef')
|
|
176
|
+
rating_right_att: int = HTField('RatingRightAtt')
|
|
177
|
+
rating_mid_att: int = HTField('RatingMidAtt')
|
|
178
|
+
rating_left_att: int = HTField('RatingLeftAtt')
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
from typing import List, Optional
|
|
2
|
+
|
|
3
|
+
from pychpp.models.ht_field import HTField
|
|
4
|
+
from pychpp.models.ht_init_var import HTInitVar
|
|
5
|
+
from pychpp.models.ht_model import HTModel
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class RequestNationalPlayers(HTModel):
|
|
9
|
+
"""
|
|
10
|
+
National Players - Request arguments
|
|
11
|
+
"""
|
|
12
|
+
SOURCE_FILE = 'nationalplayers'
|
|
13
|
+
LAST_VERSION = '1.5'
|
|
14
|
+
|
|
15
|
+
_r_action_type: Optional[str] = HTInitVar('actionType', init_arg='action_type')
|
|
16
|
+
_r_team_id: int = HTInitVar('teamID', init_arg='team_id')
|
|
17
|
+
_r_match_type_category: Optional[str] = HTInitVar('MatchTypeCategory',
|
|
18
|
+
init_arg='match_type_category')
|
|
19
|
+
_r_show_all: Optional[bool] = HTInitVar('ShowAll', init_arg='show_all')
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class NationalPlayersView(RequestNationalPlayers):
|
|
23
|
+
"""
|
|
24
|
+
National Players - View
|
|
25
|
+
"""
|
|
26
|
+
user_supporter_tier: str = HTField('UserSupporterTier')
|
|
27
|
+
action_type: str = HTField('ActionType')
|
|
28
|
+
team_id: int = HTField('TeamID')
|
|
29
|
+
team_name: str = HTField('TeamName')
|
|
30
|
+
players: List['ViewPlayerItem'] = HTField('Players', items='Player')
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class ViewPlayerItem(HTModel):
|
|
34
|
+
"""
|
|
35
|
+
National Players - View -> Players -> Player item
|
|
36
|
+
"""
|
|
37
|
+
id: int = HTField('PlayerID')
|
|
38
|
+
name: str = HTField('PlayerName')
|
|
39
|
+
cards: int = HTField('Cards')
|
|
40
|
+
specialty: int = HTField('Specialty')
|
|
41
|
+
avatar: 'Avatar' = HTField('Avatar')
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class Avatar(HTModel):
|
|
45
|
+
"""
|
|
46
|
+
National Players - View -> Players -> Player item -> Avatar
|
|
47
|
+
"""
|
|
48
|
+
background_image: str = HTField('BackgroundImage')
|
|
49
|
+
layer: 'Layer' = HTField('Layer')
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class Layer(HTModel):
|
|
53
|
+
"""
|
|
54
|
+
National Players - View -> Players -> Player item -> Avatar -> Layer
|
|
55
|
+
"""
|
|
56
|
+
x: int = HTField('.', attrib='x')
|
|
57
|
+
y: int = HTField('.', attrib='y')
|
|
58
|
+
image: str = HTField('Image')
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class NationalPlayersStats(RequestNationalPlayers):
|
|
62
|
+
"""
|
|
63
|
+
National Players - Supporter Stats
|
|
64
|
+
"""
|
|
65
|
+
user_is_supporter: bool = HTField('UserIsSupporter')
|
|
66
|
+
user_has_clubhouse: bool = HTField('UserHasClubhouse')
|
|
67
|
+
action_type: str = HTField('ActionType')
|
|
68
|
+
team_id: int = HTField('TeamID')
|
|
69
|
+
team_name: str = HTField('TeamName')
|
|
70
|
+
stats: 'Stats' = HTField('Stats')
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
class Stats(HTModel):
|
|
74
|
+
"""
|
|
75
|
+
National Players - Supporter Stats -> Stats
|
|
76
|
+
"""
|
|
77
|
+
match_type_category: str = HTField('MatchTypeCategory')
|
|
78
|
+
show_all: bool = HTField('ShowAll')
|
|
79
|
+
more_records_available: bool = HTField('MoreRecordsAvailable')
|
|
80
|
+
players: List['PlayerItemStats'] = HTField('Players', items='Player')
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class PlayerItemStats(HTModel):
|
|
84
|
+
"""
|
|
85
|
+
National Players - Supporter Stats -> Stats -> Players -> Player item
|
|
86
|
+
"""
|
|
87
|
+
id: int = HTField('PlayerID')
|
|
88
|
+
name: str = HTField('PlayerName')
|
|
89
|
+
nr_of_matches: int = HTField('NrOfMatches')
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
|
|
4
|
+
from pychpp.models.ht_field import HTField
|
|
5
|
+
from pychpp.models.ht_init_var import HTInitVar
|
|
6
|
+
from pychpp.models.ht_model import HTModel
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class RequestNationalTeamMatches(HTModel):
|
|
10
|
+
"""
|
|
11
|
+
National Team Matches - Request arguments
|
|
12
|
+
"""
|
|
13
|
+
SOURCE_FILE = 'nationalteammatches'
|
|
14
|
+
LAST_VERSION = '1.4'
|
|
15
|
+
|
|
16
|
+
_r_league_office_type_id: Optional[int] = HTInitVar('LeagueOfficeTypeID',
|
|
17
|
+
init_arg='league_office_type_id')
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class NationalTeamMatches(RequestNationalTeamMatches):
|
|
21
|
+
"""
|
|
22
|
+
National Team Matches
|
|
23
|
+
"""
|
|
24
|
+
user_supporter_tier: str = HTField('UserSupporterTier')
|
|
25
|
+
league_office_type_id: int = HTField('LeagueOfficeTypeID')
|
|
26
|
+
matches: List['MatchItem'] = HTField('Matches', items='Match')
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class MatchItem(HTModel):
|
|
30
|
+
"""
|
|
31
|
+
National Team Matches -> Matches -> Match item
|
|
32
|
+
"""
|
|
33
|
+
id: int = HTField('MatchID')
|
|
34
|
+
date: datetime = HTField('MatchDate')
|
|
35
|
+
type: int = HTField('MatchType')
|
|
36
|
+
context_id: Optional[int] = HTField('MatchContextId')
|
|
37
|
+
home_team_id: int = HTField('HomeTeamId')
|
|
38
|
+
home_team_name: str = HTField('HomeTeamName')
|
|
39
|
+
away_team_id: int = HTField('AwayTeamId')
|
|
40
|
+
away_team_name: str = HTField('AwayTeamName')
|
|
41
|
+
match_result: Optional['MatchResult'] = HTField('MatchResult')
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class MatchResult(HTModel):
|
|
45
|
+
"""
|
|
46
|
+
National Team Matches -> Matches -> Match item -> Match result
|
|
47
|
+
"""
|
|
48
|
+
home_goals: Optional[int] = HTField('HomeGoals')
|
|
49
|
+
away_goals: Optional[int] = HTField('AwayGoals')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|