pychpp 0.4.5__tar.gz → 0.4.7__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.7}/PKG-INFO +11 -3
- {pychpp-0.4.5 → pychpp-0.4.7}/README.md +10 -2
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/chpp.py +131 -3
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/ht_field.py +1 -1
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/ht_model.py +9 -5
- pychpp-0.4.7/pychpp/models/xml/match_orders.py +178 -0
- pychpp-0.4.7/pychpp/models/xml/national_players.py +89 -0
- pychpp-0.4.7/pychpp/models/xml/national_team_matches.py +49 -0
- pychpp-0.4.7/pychpp/models/xml/player_events.py +41 -0
- pychpp-0.4.7/pychpp/models/xml/search.py +49 -0
- pychpp-0.4.7/pychpp/models/xml/staff_avatars.py +61 -0
- pychpp-0.4.7/pychpp/models/xml/staff_list.py +58 -0
- pychpp-0.4.7/pychpp/models/xml/supporters.py +104 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pyproject.toml +1 -1
- {pychpp-0.4.5 → pychpp-0.4.7}/LICENSE +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/__init__.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/fixtures/__init__.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/fixtures/ht_datetime.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/fixtures/ht_error.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/__init__.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/__init__.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/base/__init__.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/base/ht_arena.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/base/ht_country.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/base/ht_league.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/base/ht_league_unit.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/base/ht_match.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/base/ht_player.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/base/ht_region.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/base/ht_team.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/base/ht_user.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/ht_arena.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/ht_challenge.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/ht_league.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/ht_league_unit.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/ht_match.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/ht_match_lineup.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/ht_matches_archive.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/ht_player.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/ht_region.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/ht_team.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/ht_transfer_history.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/ht_user.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/ht_youth_player.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/custom/ht_youth_team.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/ht_init_var.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/ht_version.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/ht_xml.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/__init__.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/achievements.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/alliance_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/alliances.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/arena_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/avatars.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/bookmarks.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/challenges.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/club.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/cup_matches.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/current_bids.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/economy.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/fans.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/hof_players.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/ladder_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/ladder_list.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/league_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/league_fixtures.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/league_levels.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/live.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/manager_compendium.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/match_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/match_lineup.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/matches.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/matches_archive.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/national_team_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/national_teams.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/player_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/players.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/region_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/team_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/training.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/transfers_team.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/world_cup.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/world_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/youth_player_details.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/pychpp/models/xml/youth_player_list.py +0 -0
- {pychpp-0.4.5 → pychpp-0.4.7}/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.7
|
|
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,13 +193,21 @@ 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` |
|
|
204
|
+
| PlayerEvents | `playerevents.xml` |
|
|
201
205
|
| Players | `players.xml` |
|
|
202
206
|
| RegionDetails | `regiondetails.xml` |
|
|
207
|
+
| Search | `search.xml` |
|
|
208
|
+
| StaffAvatars | `staffavatars.xml` |
|
|
209
|
+
| StaffList | `stafflist.xml` |
|
|
210
|
+
| Supporters | `supporters.xml` |
|
|
203
211
|
| TeamDetails | `teamdetails.xml` |
|
|
204
212
|
| Training | `training.xml` |
|
|
205
213
|
| TransfersTeam | `transfersteam.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,13 +171,21 @@ 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` |
|
|
182
|
+
| PlayerEvents | `playerevents.xml` |
|
|
179
183
|
| Players | `players.xml` |
|
|
180
184
|
| RegionDetails | `regiondetails.xml` |
|
|
185
|
+
| Search | `search.xml` |
|
|
186
|
+
| StaffAvatars | `staffavatars.xml` |
|
|
187
|
+
| StaffList | `stafflist.xml` |
|
|
188
|
+
| Supporters | `supporters.xml` |
|
|
181
189
|
| TeamDetails | `teamdetails.xml` |
|
|
182
190
|
| Training | `training.xml` |
|
|
183
191
|
| TransfersTeam | `transfersteam.xml` |
|
|
@@ -14,7 +14,8 @@ 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
|
+
player_events, search, staff_avatars, staff_list, supporters)
|
|
18
19
|
from pychpp.models.custom import (ht_team, ht_arena, ht_user, ht_region, ht_youth_team, ht_player,
|
|
19
20
|
ht_league_unit, ht_youth_player, ht_league, ht_matches_archive,
|
|
20
21
|
ht_match, ht_challenge, ht_match_lineup, ht_transfer_history)
|
|
@@ -273,7 +274,7 @@ class CHPPBase:
|
|
|
273
274
|
)
|
|
274
275
|
|
|
275
276
|
def _base_request(
|
|
276
|
-
self, url, parse_data=True, **kwargs,
|
|
277
|
+
self, url, parse_data=True, method='GET', **kwargs,
|
|
277
278
|
) -> xml.etree.ElementTree:
|
|
278
279
|
"""
|
|
279
280
|
Base method for sending a request via the CHPP API
|
|
@@ -283,7 +284,14 @@ class CHPPBase:
|
|
|
283
284
|
:return: xml data fetched on Hattrick
|
|
284
285
|
"""
|
|
285
286
|
session = self.open_session()
|
|
286
|
-
|
|
287
|
+
|
|
288
|
+
if method == 'GET':
|
|
289
|
+
query = session.get(url, params=kwargs)
|
|
290
|
+
elif method == 'POST':
|
|
291
|
+
query = session.post(url, data=kwargs)
|
|
292
|
+
else:
|
|
293
|
+
raise ValueError(f"Unknown method '{method}'")
|
|
294
|
+
|
|
287
295
|
query.encoding = "UTF-8"
|
|
288
296
|
self.last_url = query.url
|
|
289
297
|
|
|
@@ -683,6 +691,39 @@ class CHPPXml(CHPPBase):
|
|
|
683
691
|
source_system=source_system, **kwargs,
|
|
684
692
|
)
|
|
685
693
|
|
|
694
|
+
def xml_match_orders(
|
|
695
|
+
self, match_id: int, action_type: str = 'view', team_id: int = None,
|
|
696
|
+
source_system: str = 'Hattrick', lineup: str = None, **kwargs,
|
|
697
|
+
) -> Union[match_orders.MatchOrdersView,
|
|
698
|
+
match_orders.MatchOrdersSetMatchOrder,
|
|
699
|
+
match_orders.MatchOrdersPredictRatings,
|
|
700
|
+
]:
|
|
701
|
+
|
|
702
|
+
if action_type == 'view':
|
|
703
|
+
return match_orders.MatchOrdersView(
|
|
704
|
+
chpp=self, action_type=action_type, match_id=match_id,
|
|
705
|
+
team_id=team_id, source_system=source_system, lineup=lineup,
|
|
706
|
+
**kwargs,
|
|
707
|
+
)
|
|
708
|
+
|
|
709
|
+
elif action_type == 'setmatchorder':
|
|
710
|
+
return match_orders.MatchOrdersSetMatchOrder(
|
|
711
|
+
chpp=self, action_type=action_type, match_id=match_id,
|
|
712
|
+
team_id=team_id, source_system=source_system, lineup=lineup,
|
|
713
|
+
**kwargs,
|
|
714
|
+
)
|
|
715
|
+
|
|
716
|
+
elif action_type == 'predictratings':
|
|
717
|
+
return match_orders.MatchOrdersPredictRatings(
|
|
718
|
+
chpp=self, action_type=action_type, match_id=match_id,
|
|
719
|
+
team_id=team_id, source_system=source_system, lineup=lineup,
|
|
720
|
+
**kwargs,
|
|
721
|
+
)
|
|
722
|
+
|
|
723
|
+
else:
|
|
724
|
+
raise ValueError("if set, 'action_type' must be equal to"
|
|
725
|
+
"'view', 'setmatchorder' or 'predictratings'")
|
|
726
|
+
|
|
686
727
|
def xml_matches(
|
|
687
728
|
self, team_id: int = None, is_youth: bool = None, **kwargs,
|
|
688
729
|
) -> matches.Matches:
|
|
@@ -719,6 +760,44 @@ class CHPPXml(CHPPBase):
|
|
|
719
760
|
chpp=self, team_id=team_id, **kwargs,
|
|
720
761
|
)
|
|
721
762
|
|
|
763
|
+
def xml_national_team_matches(
|
|
764
|
+
self, league_office_type_id: int = None, **kwargs,
|
|
765
|
+
) -> national_team_matches.NationalTeamMatches:
|
|
766
|
+
|
|
767
|
+
return national_team_matches.NationalTeamMatches(
|
|
768
|
+
chpp=self, league_office_type_id=league_office_type_id, **kwargs,
|
|
769
|
+
)
|
|
770
|
+
|
|
771
|
+
def xml_national_players(
|
|
772
|
+
self, team_id: int, action_type: str = 'view', match_type_category: int = None,
|
|
773
|
+
show_all: bool = None, **kwargs,
|
|
774
|
+
) -> Union[national_players.NationalPlayersView,
|
|
775
|
+
national_players.NationalPlayersStats,
|
|
776
|
+
]:
|
|
777
|
+
|
|
778
|
+
if action_type == 'view':
|
|
779
|
+
return national_players.NationalPlayersView(
|
|
780
|
+
chpp=self, action_type=action_type, team_id=team_id, **kwargs,
|
|
781
|
+
)
|
|
782
|
+
|
|
783
|
+
elif action_type == 'SupporterStats':
|
|
784
|
+
return national_players.NationalPlayersStats(
|
|
785
|
+
chpp=self, action_type=action_type, team_id=team_id,
|
|
786
|
+
match_type_category=match_type_category, show_all=show_all, **kwargs,
|
|
787
|
+
)
|
|
788
|
+
|
|
789
|
+
else:
|
|
790
|
+
raise ValueError("if set, 'action_type' must be equal to"
|
|
791
|
+
"'view', 'setmatchorder' or 'SupporterStats'")
|
|
792
|
+
|
|
793
|
+
def xml_player_events(
|
|
794
|
+
self, player_id: int = None, **kwargs,
|
|
795
|
+
) -> player_events.PlayerEvents:
|
|
796
|
+
|
|
797
|
+
return player_events.PlayerEvents(
|
|
798
|
+
chpp=self, player_id=player_id, **kwargs,
|
|
799
|
+
)
|
|
800
|
+
|
|
722
801
|
def xml_players(self, action_type: str = 'view', order_by: str = None,
|
|
723
802
|
team_id: int = None, include_match_info: bool = None, **kwargs,
|
|
724
803
|
) -> Union[players.PlayersView,
|
|
@@ -766,6 +845,55 @@ class CHPPXml(CHPPBase):
|
|
|
766
845
|
chpp=self, region_id=region_id, **kwargs,
|
|
767
846
|
)
|
|
768
847
|
|
|
848
|
+
def xml_search(
|
|
849
|
+
self, search_type: int = None, search_string: str = None,
|
|
850
|
+
search_string_2: str = None, search_id: int = None, search_league_id: int = None,
|
|
851
|
+
page_index: int = None, **kwargs,
|
|
852
|
+
) -> search.Search:
|
|
853
|
+
|
|
854
|
+
return search.Search(
|
|
855
|
+
chpp=self, search_type=search_type, search_string=search_string,
|
|
856
|
+
search_string_2=search_string_2, search_id=search_id,
|
|
857
|
+
search_league_id=search_league_id, page_index=page_index, **kwargs,
|
|
858
|
+
)
|
|
859
|
+
|
|
860
|
+
def xml_staff_avatars(
|
|
861
|
+
self, team_id: int = None, **kwargs,
|
|
862
|
+
) -> staff_avatars.StaffAvatars:
|
|
863
|
+
|
|
864
|
+
return staff_avatars.StaffAvatars(
|
|
865
|
+
chpp=self, team_id=team_id, **kwargs,
|
|
866
|
+
)
|
|
867
|
+
|
|
868
|
+
def xml_staff_list(
|
|
869
|
+
self, team_id: int = None, **kwargs,
|
|
870
|
+
) -> staff_list.StaffList:
|
|
871
|
+
|
|
872
|
+
return staff_list.StaffList(
|
|
873
|
+
chpp=self, team_id=team_id, **kwargs,
|
|
874
|
+
)
|
|
875
|
+
|
|
876
|
+
def xml_supporters(
|
|
877
|
+
self, action_type: str = 'supportedteams',
|
|
878
|
+
user_id: int = None, team_id: int = None, **kwargs,
|
|
879
|
+
) -> Union[supporters.SupportersSupportedTeams,
|
|
880
|
+
supporters.SupportersMySupporters,
|
|
881
|
+
]:
|
|
882
|
+
|
|
883
|
+
if action_type == 'supportedteams':
|
|
884
|
+
return supporters.SupportersSupportedTeams(
|
|
885
|
+
chpp=self, action_type=action_type, user_id=user_id, **kwargs,
|
|
886
|
+
)
|
|
887
|
+
|
|
888
|
+
elif action_type == 'mysupporters':
|
|
889
|
+
return supporters.SupportersMySupporters(
|
|
890
|
+
chpp=self, action_type=action_type, team_id=team_id, **kwargs,
|
|
891
|
+
)
|
|
892
|
+
|
|
893
|
+
else:
|
|
894
|
+
raise ValueError("if set, 'action_type' must be equal to"
|
|
895
|
+
"'view', 'supportedteams' or 'mysupporters'")
|
|
896
|
+
|
|
769
897
|
def xml_team_details(
|
|
770
898
|
self, team_id: int = None, user_id: int = None,
|
|
771
899
|
include_domestics_flags: bool = None, include_flags: bool = None,
|
|
@@ -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
|
)
|
|
@@ -209,7 +211,9 @@ class HTModel(metaclass=MetaHTModel):
|
|
|
209
211
|
if proxy_path and proxy_path[-1] != '/':
|
|
210
212
|
proxy_path += '/'
|
|
211
213
|
proxy_path += previous_xml_prefix + target_field.path
|
|
212
|
-
previous_xml_prefix = target_field.xml_prefix
|
|
214
|
+
previous_xml_prefix = (target_field.xml_prefix
|
|
215
|
+
if target_field.xml_prefix is not None
|
|
216
|
+
else '')
|
|
213
217
|
|
|
214
218
|
if issubclass(type_, HTModel):
|
|
215
219
|
target_cls = type_
|
|
@@ -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')
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
from typing import 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 RequestPlayerEvents(HTModel):
|
|
10
|
+
"""
|
|
11
|
+
Player Events - Request arguments
|
|
12
|
+
"""
|
|
13
|
+
SOURCE_FILE = 'playerevents'
|
|
14
|
+
LAST_VERSION = '1.3'
|
|
15
|
+
|
|
16
|
+
_r_player_id: int = HTInitVar('playerID', init_arg='player_id')
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class PlayerEvents(RequestPlayerEvents):
|
|
20
|
+
"""
|
|
21
|
+
Player Events
|
|
22
|
+
"""
|
|
23
|
+
user_supporter_tier: str = HTField('UserSupporterTier')
|
|
24
|
+
player: 'Player' = HTField('Player')
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class Player(HTModel):
|
|
28
|
+
"""
|
|
29
|
+
Player Events -> Player
|
|
30
|
+
"""
|
|
31
|
+
id: int = HTField('PlayerID')
|
|
32
|
+
events: List['EventItem'] = HTField('PlayerEvents', items='PlayerEvent')
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class EventItem(HTModel):
|
|
36
|
+
"""
|
|
37
|
+
Player Events -> Player -> Events -> Event item
|
|
38
|
+
"""
|
|
39
|
+
date: datetime = HTField('EventDate')
|
|
40
|
+
type_id: int = HTField('PlayerEventTypeID')
|
|
41
|
+
text: str = HTField('EventText')
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
from typing import Optional, List
|
|
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 RequestSearch(HTModel):
|
|
9
|
+
"""
|
|
10
|
+
Search - Request arguments
|
|
11
|
+
"""
|
|
12
|
+
SOURCE_FILE = 'search'
|
|
13
|
+
LAST_VERSION = '1.2'
|
|
14
|
+
|
|
15
|
+
_r_search_type: Optional[int] = HTInitVar('searchType', init_arg='search_type')
|
|
16
|
+
_r_search_string: Optional[str] = HTInitVar('searchString', init_arg='search_string')
|
|
17
|
+
_r_search_string_2: Optional[int] = HTInitVar('searchString2', init_arg='search_string_2')
|
|
18
|
+
_r_search_id: Optional[int] = HTInitVar('searchID', init_arg='search_id')
|
|
19
|
+
_r_search_league_id: Optional[int] = HTInitVar('searchLeagueID', init_arg='search_league_id')
|
|
20
|
+
_r_page_index: Optional[int] = HTInitVar('pageIndex', init_arg='page_index')
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class Search(RequestSearch):
|
|
24
|
+
"""
|
|
25
|
+
Search
|
|
26
|
+
"""
|
|
27
|
+
search_params: 'SearchParams' = HTField('SearchParams')
|
|
28
|
+
page_index: int = HTField('PageIndex')
|
|
29
|
+
pages: int = HTField('Pages')
|
|
30
|
+
search_results: List['ResultItem'] = HTField('SearchResults', items='Result')
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class SearchParams(HTModel):
|
|
34
|
+
"""
|
|
35
|
+
Search -> Search params
|
|
36
|
+
"""
|
|
37
|
+
type: int = HTField('SearchType')
|
|
38
|
+
string: str = HTField('SearchString')
|
|
39
|
+
string_2: str = HTField('SearchString2')
|
|
40
|
+
id: int = HTField('SearchID')
|
|
41
|
+
league_id: int = HTField('SearchLeagueID')
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class ResultItem(HTModel):
|
|
45
|
+
"""
|
|
46
|
+
Search -> Search results -> Result item
|
|
47
|
+
"""
|
|
48
|
+
id: int = HTField('ResultID')
|
|
49
|
+
name: str = HTField('ResultName')
|
|
@@ -0,0 +1,61 @@
|
|
|
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 RequestStaffAvatars(HTModel):
|
|
9
|
+
"""
|
|
10
|
+
Staff Avatars - Request arguments
|
|
11
|
+
"""
|
|
12
|
+
SOURCE_FILE = 'staffavatars'
|
|
13
|
+
LAST_VERSION = '1.1'
|
|
14
|
+
|
|
15
|
+
_r_team_id: Optional[int] = HTInitVar('teamId', init_arg='team_id')
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class StaffAvatars(RequestStaffAvatars):
|
|
19
|
+
"""
|
|
20
|
+
Staff Avatars
|
|
21
|
+
"""
|
|
22
|
+
trainer: 'Trainer' = HTField('Trainer')
|
|
23
|
+
staff_members: List['StaffMemberItem'] = HTField('StaffMembers', items='Staff')
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class CommonTrainerStaffMemberItem(HTModel):
|
|
27
|
+
"""
|
|
28
|
+
Staff Avatars -> Trainer / Staff member item
|
|
29
|
+
"""
|
|
30
|
+
avatar: 'Avatar' = HTField('Avatar')
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class Avatar(HTModel):
|
|
34
|
+
"""
|
|
35
|
+
Staff Avatars -> Trainer / Staff member item -> Avatar
|
|
36
|
+
"""
|
|
37
|
+
background_image: str = HTField('BackgroundImage')
|
|
38
|
+
layers: List['LayerItem'] = HTField('.', items='Layer')
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class LayerItem(HTModel):
|
|
42
|
+
"""
|
|
43
|
+
Staff Avatars -> Trainer / Staff member item -> Avatar -> Layer
|
|
44
|
+
"""
|
|
45
|
+
x: int = HTField('.', attrib='x')
|
|
46
|
+
y: int = HTField('.', attrib='y')
|
|
47
|
+
image: str = HTField('Image')
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class Trainer(CommonTrainerStaffMemberItem):
|
|
51
|
+
"""
|
|
52
|
+
Staff Avatars -> Trainer
|
|
53
|
+
"""
|
|
54
|
+
id: int = HTField('TrainerId')
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class StaffMemberItem(CommonTrainerStaffMemberItem):
|
|
58
|
+
"""
|
|
59
|
+
Staff Avatars -> Staff members -> Staff member item
|
|
60
|
+
"""
|
|
61
|
+
id: int = HTField('StaffId')
|
|
@@ -0,0 +1,58 @@
|
|
|
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 RequestStaffList(HTModel):
|
|
10
|
+
"""
|
|
11
|
+
Staff List - Request arguments
|
|
12
|
+
"""
|
|
13
|
+
SOURCE_FILE = 'stafflist'
|
|
14
|
+
LAST_VERSION = '1.2'
|
|
15
|
+
|
|
16
|
+
_r_team_id: Optional[int] = HTInitVar('teamId', init_arg='team_id')
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class StaffList(RequestStaffList):
|
|
20
|
+
"""
|
|
21
|
+
Staff List
|
|
22
|
+
"""
|
|
23
|
+
XML_PREFIX = 'StaffList/'
|
|
24
|
+
|
|
25
|
+
trainer: 'Trainer' = HTField('Trainer')
|
|
26
|
+
staff_members: List['StaffMemberItem'] = HTField('StaffMembers', items='Staff')
|
|
27
|
+
total_staff_members: int = HTField('TotalStaffMembers')
|
|
28
|
+
total_cost: int = HTField('TotalCost')
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class Trainer(HTModel):
|
|
32
|
+
"""
|
|
33
|
+
Staff List -> Trainer
|
|
34
|
+
"""
|
|
35
|
+
id: int = HTField('TrainerId')
|
|
36
|
+
name: str = HTField('Name')
|
|
37
|
+
age: int = HTField('Age')
|
|
38
|
+
age_days: int = HTField('AgeDays')
|
|
39
|
+
contract_date: datetime = HTField('ContractDate')
|
|
40
|
+
cost: int = HTField('Cost')
|
|
41
|
+
country_id: int = HTField('CountryID')
|
|
42
|
+
type: int = HTField('TrainerType')
|
|
43
|
+
leadership: int = HTField('Leadership')
|
|
44
|
+
skill_level: int = HTField('TrainerSkillLevel')
|
|
45
|
+
status: int = HTField('TrainerStatus')
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class StaffMemberItem(HTModel):
|
|
49
|
+
"""
|
|
50
|
+
Staff List -> Staff members -> Staff member item
|
|
51
|
+
"""
|
|
52
|
+
id: int = HTField('StaffId')
|
|
53
|
+
name: str = HTField('Name')
|
|
54
|
+
type: int = HTField('StaffType')
|
|
55
|
+
level: int = HTField('StaffLevel')
|
|
56
|
+
hired_date: datetime = HTField('HiredDate')
|
|
57
|
+
cost: int = HTField('Cost')
|
|
58
|
+
hof_player_id: int = HTField('HofPlayerId')
|
|
@@ -0,0 +1,104 @@
|
|
|
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 RequestSupporters(HTModel):
|
|
10
|
+
"""
|
|
11
|
+
Supporters - Request arguments
|
|
12
|
+
"""
|
|
13
|
+
SOURCE_FILE = 'supporters'
|
|
14
|
+
LAST_VERSION = '1.0'
|
|
15
|
+
|
|
16
|
+
_r_action_type: Optional[str] = HTInitVar('actionType', init_arg='action_type')
|
|
17
|
+
_r_user_id: Optional[int] = HTInitVar('userId', init_arg='user_id')
|
|
18
|
+
_r_team_id: Optional[int] = HTInitVar('teamId', init_arg='team_id')
|
|
19
|
+
_r_page_index: Optional[int] = HTInitVar('pageIndex', init_arg='page_index')
|
|
20
|
+
_r_page_size: Optional[int] = HTInitVar('pageSize', init_arg='page_size')
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class SupportersSupportedTeams(RequestSupporters):
|
|
24
|
+
"""
|
|
25
|
+
Supporters - Supported teams
|
|
26
|
+
"""
|
|
27
|
+
total_supported_teams: int = HTField('SupportedTeams', attrib='TotalItems')
|
|
28
|
+
supported_teams: List['SupportedTeamItem'] = HTField('SupportedTeams', items='SupportedTeam')
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class SupportersMySupporters(RequestSupporters):
|
|
32
|
+
"""
|
|
33
|
+
Supporters - My supporters
|
|
34
|
+
"""
|
|
35
|
+
total_supporters: int = HTField('MySupporters', attrib='TotalItems')
|
|
36
|
+
my_supporters: List['MySupportersTeamItem'] = HTField('MySupporters', items='SupporterTeam')
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class CommonTeamItem(HTModel):
|
|
40
|
+
"""
|
|
41
|
+
Supporters - Supported teams/My Supporters -> Supported teams/My Supporters -> Team item
|
|
42
|
+
"""
|
|
43
|
+
user_id: int = HTField('UserId')
|
|
44
|
+
login_name: str = HTField('LoginName')
|
|
45
|
+
team_id: int = HTField('TeamId')
|
|
46
|
+
team_name: str = HTField('TeamName')
|
|
47
|
+
league_id: int = HTField('LeagueID')
|
|
48
|
+
league_name: str = HTField('LeagueName')
|
|
49
|
+
league_level_unit_id: int = HTField('LeagueLevelUnitID')
|
|
50
|
+
league_level_unit_name: str = HTField('LeagueLevelUnitName')
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class SupportedTeamItem(CommonTeamItem):
|
|
54
|
+
"""
|
|
55
|
+
Supporters - Supported teams -> Supported teams -> Team item
|
|
56
|
+
"""
|
|
57
|
+
last_match: 'LastMatch' = HTField('LastMatch')
|
|
58
|
+
next_match: 'NextMatch' = HTField('NextMatch')
|
|
59
|
+
press_announcement: Optional['PressAnnouncement'] = HTField('PressAnnouncement')
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class MySupportersTeamItem(CommonTeamItem):
|
|
63
|
+
"""
|
|
64
|
+
Supporters - Supported teams -> My Supporters -> Team item
|
|
65
|
+
"""
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class CommonLastNextMatch(HTModel):
|
|
69
|
+
"""
|
|
70
|
+
Supporters - Supported teams -> Supported teams -> Team item -> Last/Next match
|
|
71
|
+
"""
|
|
72
|
+
id: int = HTField('Id')
|
|
73
|
+
date: datetime = HTField('Date')
|
|
74
|
+
home_team_id: int = HTField('HomeTeamId')
|
|
75
|
+
home_team_name: str = HTField('HomeTeamName')
|
|
76
|
+
away_team_id: int = HTField('AwayTeamId')
|
|
77
|
+
away_team_name: str = HTField('AwayTeamName')
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class LastMatch(CommonLastNextMatch):
|
|
81
|
+
"""
|
|
82
|
+
Supporters - Supported teams -> Supported teams -> Team item -> Last match
|
|
83
|
+
"""
|
|
84
|
+
XML_PREFIX = 'LastMatch'
|
|
85
|
+
home_goals: int = HTField('HomeGoals')
|
|
86
|
+
away_goals: int = HTField('AwayGoals')
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
class NextMatch(CommonLastNextMatch):
|
|
90
|
+
"""
|
|
91
|
+
Supporters - Supported teams -> Supported teams -> Team item -> Next match
|
|
92
|
+
"""
|
|
93
|
+
XML_PREFIX = 'NextMatch'
|
|
94
|
+
date: datetime = HTField('MatchDate')
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
class PressAnnouncement(HTModel):
|
|
98
|
+
"""
|
|
99
|
+
Supporters - Supported teams -> Supported teams -> Team item -> Press Announcement
|
|
100
|
+
"""
|
|
101
|
+
XML_PREFIX = 'PressAnnouncement'
|
|
102
|
+
send_date: datetime = HTField('SendDate')
|
|
103
|
+
subject: str = HTField('Subject')
|
|
104
|
+
body: str = HTField('Body')
|
|
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
|