pychpp 0.4.9__tar.gz → 0.5.1__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.
Files changed (98) hide show
  1. {pychpp-0.4.9 → pychpp-0.5.1}/PKG-INFO +7 -5
  2. {pychpp-0.4.9 → pychpp-0.5.1}/README.md +5 -3
  3. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/chpp.py +46 -43
  4. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/ht_xml.py +1 -1
  5. pychpp-0.5.1/pychpp/models/xml/translations.py +122 -0
  6. pychpp-0.5.1/pychpp/models/xml/youth_league_fixtures.py +52 -0
  7. {pychpp-0.4.9 → pychpp-0.5.1}/pyproject.toml +2 -2
  8. {pychpp-0.4.9 → pychpp-0.5.1}/LICENSE +0 -0
  9. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/__init__.py +0 -0
  10. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/fixtures/__init__.py +0 -0
  11. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/fixtures/ht_datetime.py +0 -0
  12. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/fixtures/ht_error.py +0 -0
  13. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/__init__.py +0 -0
  14. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/__init__.py +0 -0
  15. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/base/__init__.py +0 -0
  16. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/base/ht_arena.py +0 -0
  17. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/base/ht_country.py +0 -0
  18. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/base/ht_league.py +0 -0
  19. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/base/ht_league_unit.py +0 -0
  20. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/base/ht_match.py +0 -0
  21. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/base/ht_player.py +0 -0
  22. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/base/ht_region.py +0 -0
  23. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/base/ht_team.py +0 -0
  24. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/base/ht_user.py +0 -0
  25. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/ht_arena.py +0 -0
  26. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/ht_challenge.py +0 -0
  27. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/ht_league.py +0 -0
  28. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/ht_league_unit.py +0 -0
  29. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/ht_match.py +0 -0
  30. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/ht_match_lineup.py +0 -0
  31. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/ht_matches_archive.py +0 -0
  32. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/ht_player.py +0 -0
  33. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/ht_region.py +0 -0
  34. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/ht_team.py +0 -0
  35. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/ht_transfer_history.py +0 -0
  36. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/ht_user.py +0 -0
  37. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/ht_youth_player.py +0 -0
  38. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/custom/ht_youth_team.py +0 -0
  39. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/ht_field.py +0 -0
  40. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/ht_init_var.py +0 -0
  41. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/ht_model.py +0 -0
  42. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/ht_version.py +0 -0
  43. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/__init__.py +0 -0
  44. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/achievements.py +0 -0
  45. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/alliance_details.py +0 -0
  46. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/alliances.py +0 -0
  47. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/arena_details.py +0 -0
  48. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/avatars.py +0 -0
  49. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/bookmarks.py +0 -0
  50. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/challenges.py +0 -0
  51. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/club.py +0 -0
  52. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/cup_matches.py +0 -0
  53. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/current_bids.py +0 -0
  54. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/economy.py +0 -0
  55. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/fans.py +0 -0
  56. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/hof_players.py +0 -0
  57. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/ladder_details.py +0 -0
  58. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/ladder_list.py +0 -0
  59. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/league_details.py +0 -0
  60. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/league_fixtures.py +0 -0
  61. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/league_levels.py +0 -0
  62. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/live.py +0 -0
  63. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/manager_compendium.py +0 -0
  64. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/match_details.py +0 -0
  65. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/match_lineup.py +0 -0
  66. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/match_orders.py +0 -0
  67. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/matches.py +0 -0
  68. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/matches_archive.py +0 -0
  69. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/national_players.py +0 -0
  70. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/national_team_details.py +0 -0
  71. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/national_team_matches.py +0 -0
  72. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/national_teams.py +0 -0
  73. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/player_details.py +0 -0
  74. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/player_events.py +0 -0
  75. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/players.py +0 -0
  76. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/region_details.py +0 -0
  77. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/search.py +0 -0
  78. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/staff_avatars.py +0 -0
  79. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/staff_list.py +0 -0
  80. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/supporters.py +0 -0
  81. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/team_details.py +0 -0
  82. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/tournament_details.py +0 -0
  83. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/tournament_fixtures.py +0 -0
  84. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/tournament_league_tables.py +0 -0
  85. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/tournament_list.py +0 -0
  86. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/training.py +0 -0
  87. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/training_events.py +0 -0
  88. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/transfer_search.py +0 -0
  89. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/transfers_player.py +0 -0
  90. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/transfers_team.py +0 -0
  91. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/world_cup.py +0 -0
  92. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/world_details.py +0 -0
  93. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/world_languages.py +0 -0
  94. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/youth_avatars.py +0 -0
  95. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/youth_league_details.py +0 -0
  96. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/youth_player_details.py +0 -0
  97. {pychpp-0.4.9 → pychpp-0.5.1}/pychpp/models/xml/youth_player_list.py +0 -0
  98. {pychpp-0.4.9 → pychpp-0.5.1}/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.9
3
+ Version: 0.5.1
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
@@ -17,7 +17,7 @@ Classifier: Programming Language :: Python :: 3.12
17
17
  Classifier: Programming Language :: Python :: 3.13
18
18
  Requires-Dist: Werkzeug (>=2.2.2,<3.0.0)
19
19
  Requires-Dist: pytz (>=2024.2,<2025.0)
20
- Requires-Dist: rauth (>=0.7.3,<0.8.0)
20
+ Requires-Dist: requests-oauthlib (>=2.0.0,<3.0.0)
21
21
  Description-Content-Type: text/markdown
22
22
 
23
23
  # pyCHPP
@@ -57,8 +57,8 @@ pyCHPP can be installed using pip :
57
57
  # access_token['key'] and access_token['secret'] have to be stored
58
58
  # in order to be used later by the app
59
59
  >>> access_token = chpp.get_access_token(
60
- request_token=auth["request_token"],
61
- request_token_secret=auth["request_token_secret"],
60
+ request_token=auth["oauth_token"],
61
+ request_token_secret=auth["oauth_token_secret"],
62
62
  code=code,
63
63
  )
64
64
  ```
@@ -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
- ![55/57](https://progress-bar.xyz/96/?title=55%20on%2057)
168
+ ![57/57](https://progress-bar.xyz/100/?title=57%20on%2057)
169
169
 
170
170
  The following table shows the CHPP XML files that are currently supported:
171
171
 
@@ -218,11 +218,13 @@ The following table shows the CHPP XML files that are currently supported:
218
218
  | TransferSearch | `transfersearch.xml` |
219
219
  | TransfersPlayer | `transfersplayer.xml` |
220
220
  | TransfersTeam | `transfersteam.xml` |
221
+ | Translations | `translations.xml` |
221
222
  | WorldCup | `worldcup.xml` |
222
223
  | WorldDetails | `worlddetails.xml` |
223
224
  | WorldLanguages | `worldlanguages.xml` |
224
225
  | YouthAvatars | `youthavatars.xml` |
225
226
  | YouthLeagueDetails | `youthleaguedetails.xml` |
227
+ | YouthLeagueFixtures | `youthleaguefixtures.xml` |
226
228
  | YouthPlayerDetails | `youthplayerdetails.xml` |
227
229
  | YouthPlayerList | `youthplayerlist.xml` |
228
230
  | YouthTeamDetails | `youthteamdetails.xml` |
@@ -35,8 +35,8 @@ pyCHPP can be installed using pip :
35
35
  # access_token['key'] and access_token['secret'] have to be stored
36
36
  # in order to be used later by the app
37
37
  >>> access_token = chpp.get_access_token(
38
- request_token=auth["request_token"],
39
- request_token_secret=auth["request_token_secret"],
38
+ request_token=auth["oauth_token"],
39
+ request_token_secret=auth["oauth_token_secret"],
40
40
  code=code,
41
41
  )
42
42
  ```
@@ -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
- ![55/57](https://progress-bar.xyz/96/?title=55%20on%2057)
146
+ ![57/57](https://progress-bar.xyz/100/?title=57%20on%2057)
147
147
 
148
148
  The following table shows the CHPP XML files that are currently supported:
149
149
 
@@ -196,11 +196,13 @@ The following table shows the CHPP XML files that are currently supported:
196
196
  | TransferSearch | `transfersearch.xml` |
197
197
  | TransfersPlayer | `transfersplayer.xml` |
198
198
  | TransfersTeam | `transfersteam.xml` |
199
+ | Translations | `translations.xml` |
199
200
  | WorldCup | `worldcup.xml` |
200
201
  | WorldDetails | `worlddetails.xml` |
201
202
  | WorldLanguages | `worldlanguages.xml` |
202
203
  | YouthAvatars | `youthavatars.xml` |
203
204
  | YouthLeagueDetails | `youthleaguedetails.xml` |
205
+ | YouthLeagueFixtures | `youthleaguefixtures.xml` |
204
206
  | YouthPlayerDetails | `youthplayerdetails.xml` |
205
207
  | YouthPlayerList | `youthplayerlist.xml` |
206
208
  | YouthTeamDetails | `youthteamdetails.xml` |
@@ -1,11 +1,10 @@
1
1
  from datetime import datetime
2
2
  from typing import Union, Optional
3
3
 
4
- from rauth import OAuth1Service
5
- from rauth import OAuth1Session
6
- from rauth.oauth import HmacSha1Signature
7
4
  import xml.etree.ElementTree
8
5
 
6
+ from requests_oauthlib import OAuth1Session
7
+
9
8
  from pychpp.models.xml import (manager_compendium, team_details, achievements, arena_details,
10
9
  challenges, region_details, league_details, league_fixtures,
11
10
  match_lineup, national_teams, national_team_details, player_details,
@@ -18,7 +17,8 @@ from pychpp.models.xml import (manager_compendium, team_details, achievements, a
18
17
  player_events, search, staff_avatars, staff_list, supporters,
19
18
  tournament_details, tournament_fixtures, tournament_league_tables,
20
19
  tournament_list, training_events, transfer_search, transfers_player,
21
- world_languages, youth_avatars, youth_league_details)
20
+ world_languages, youth_avatars, youth_league_details,
21
+ youth_league_fixtures, translations)
22
22
  from pychpp.models.custom import (ht_team, ht_arena, ht_user, ht_region, ht_youth_team, ht_player,
23
23
  ht_league_unit, ht_youth_player, ht_league, ht_matches_archive,
24
24
  ht_match, ht_challenge, ht_match_lineup, ht_transfer_history)
@@ -73,15 +73,7 @@ class CHPPBase:
73
73
  self.invalidate_token_url = (
74
74
  "https://chpp.hattrick.org/oauth/invalidate_token.ashx")
75
75
 
76
- self.service = OAuth1Service(
77
- consumer_key=self.consumer_key,
78
- consumer_secret=self.consumer_secret,
79
- request_token_url=self.request_token_url,
80
- access_token_url=self.access_token_url,
81
- authorize_url=self.authorize_url,
82
- base_url=self.base_url,
83
- signature_obj=HmacSha1Signature,
84
- )
76
+ self.session = None
85
77
 
86
78
  @staticmethod
87
79
  def _analyze_error(xml_data):
@@ -173,7 +165,7 @@ class CHPPBase:
173
165
  Get url, request_token and request_token_secret
174
166
  to get authentification tokens from Hattrick for this user
175
167
 
176
- :param callback_url: url that have to be request by Hattrick
168
+ :param callback_url: url that have to be requested by Hattrick
177
169
  after the user have fill his credentials
178
170
  :param scope: authorization granted by user to the application
179
171
  can be one or more from "", "manage_challenges",
@@ -217,16 +209,12 @@ class CHPPBase:
217
209
  else:
218
210
  raise ValueError("Scope parameter must be a string a or list")
219
211
 
220
- auth = dict()
221
-
222
- request_token, request_token_secret = (
223
- self.service.get_request_token(
224
- params={"oauth_callback": callback_url}))
225
-
226
- auth["request_token"] = request_token
227
- auth["request_token_secret"] = request_token_secret
228
- auth["url"] = (
229
- self.service.get_authorize_url(request_token, scope=scope))
212
+ oauth = OAuth1Session(client_key=self.consumer_key,
213
+ client_secret=self.consumer_secret,
214
+ callback_uri=callback_url,
215
+ )
216
+ auth = oauth.fetch_request_token(self.request_token_url)
217
+ auth["url"] = oauth.authorization_url(self.authorize_url, scope=scope)
230
218
 
231
219
  return auth
232
220
 
@@ -253,28 +241,26 @@ class CHPPBase:
253
241
  elif not isinstance(code, str):
254
242
  raise ValueError("code must be a string")
255
243
 
256
- access_token_query = (
257
- self.service.get_access_token(request_token,
258
- request_token_secret,
259
- params={"oauth_verifier": code},
260
- ))
261
-
262
- access_token = dict()
244
+ oauth = OAuth1Session(client_key=self.consumer_key,
245
+ client_secret=self.consumer_secret,
246
+ resource_owner_key=request_token,
247
+ resource_owner_secret=request_token_secret,
248
+ verifier=code,
249
+ )
263
250
 
264
- access_token["key"] = access_token_query[0]
265
- access_token["secret"] = access_token_query[1]
251
+ tokens = oauth.fetch_access_token(self.access_token_url)
266
252
 
267
- return access_token
253
+ return dict(key=tokens['oauth_token'], secret=tokens['oauth_token_secret'])
268
254
 
269
255
  def open_session(self):
270
256
  """
271
257
  Open OAuth session
272
258
  """
273
- return OAuth1Session(self.consumer_key,
274
- self.consumer_secret,
275
- access_token=self.access_token_key,
276
- access_token_secret=self.access_token_secret,
277
- )
259
+ self.session = OAuth1Session(client_key=self.consumer_key,
260
+ client_secret=self.consumer_secret,
261
+ resource_owner_key=self.access_token_key,
262
+ resource_owner_secret=self.access_token_secret,
263
+ )
278
264
 
279
265
  def _base_request(
280
266
  self, url, parse_data=True, method='GET', **kwargs,
@@ -286,12 +272,13 @@ class CHPPBase:
286
272
  :param parse_data: parse or not returned data as xml
287
273
  :return: xml data fetched on Hattrick
288
274
  """
289
- session = self.open_session()
275
+ if self.session is None:
276
+ self.open_session()
290
277
 
291
278
  if method == 'GET':
292
- query = session.get(url, params=kwargs)
279
+ query = self.session.get(url, params=kwargs)
293
280
  elif method == 'POST':
294
- query = session.post(url, data=kwargs)
281
+ query = self.session.post(url, data=kwargs)
295
282
  else:
296
283
  raise ValueError(f"Unknown method '{method}'")
297
284
 
@@ -301,7 +288,7 @@ class CHPPBase:
301
288
  if query.status_code == 401:
302
289
  raise ht_error.HTUnauthorizedAction(
303
290
  "The requested action seems to be unauthorized "
304
- "(401 error code). Please heck your credentials scope.")
291
+ "(401 error code). Please check your credentials scope.")
305
292
 
306
293
  if not parse_data:
307
294
  return query.text
@@ -1027,6 +1014,14 @@ class CHPPXml(CHPPBase):
1027
1014
  chpp=self, team_id=team_id, page_index=page_index, **kwargs,
1028
1015
  )
1029
1016
 
1017
+ def xml_translations(
1018
+ self, language_id: int = None, **kwargs,
1019
+ ) -> translations.Translations:
1020
+
1021
+ return translations.Translations(
1022
+ chpp=self, language_id=language_id, **kwargs,
1023
+ )
1024
+
1030
1025
  def xml_world_cup(
1031
1026
  self, action_type: str = 'viewMatches', cup_id: int = None,
1032
1027
  season: int = None, match_round: int = None,
@@ -1080,6 +1075,14 @@ class CHPPXml(CHPPBase):
1080
1075
  chpp=self, youth_league_id=youth_league_id, **kwargs,
1081
1076
  )
1082
1077
 
1078
+ def xml_youth_league_fixtures(
1079
+ self, youth_league_id: int = None, season: int = None, **kwargs,
1080
+ ) -> youth_league_fixtures.YouthLeagueFixtures:
1081
+
1082
+ return youth_league_fixtures.YouthLeagueFixtures(
1083
+ chpp=self, youth_league_id=youth_league_id, season=season, **kwargs,
1084
+ )
1085
+
1083
1086
  def xml_youth_player_details(
1084
1087
  self, action_type: str = None, youth_player_id: int = None,
1085
1088
  show_scout_call: bool = None, show_last_match: bool = None,
@@ -30,7 +30,7 @@ class HTXml:
30
30
  @staticmethod
31
31
  def ht_float(data: ElementTree.Element, attrib: str = None):
32
32
  if attrib is not None:
33
- return float(data.attrib.get(attrib, None))
33
+ return float(data.attrib.get(attrib, None).replace(',', '.'))
34
34
  else:
35
35
  return float(data.text.replace(',', '.')) if data.text is not None else None
36
36
 
@@ -0,0 +1,122 @@
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 RequestTranslations(HTModel):
9
+ """
10
+ Translations - Request arguments
11
+ """
12
+ SOURCE_FILE = 'translations'
13
+ LAST_VERSION = '1.2'
14
+
15
+ _r_language_id: Optional[int] = HTInitVar('languageId', init_arg='language_id')
16
+
17
+
18
+ class Translations(RequestTranslations):
19
+ """
20
+ Translations
21
+ """
22
+ id: int = HTField('Language', attrib='Id')
23
+ name: str = HTField('Language')
24
+ texts: 'Texts' = HTField('Texts')
25
+
26
+
27
+ class Texts(HTModel):
28
+ """
29
+ Translations -> Texts
30
+ """
31
+ skill_names: List['SkillNameItem'] = HTField('SkillNames', items='Skill')
32
+ skill_levels: List['SkillLevelItem'] = HTField('SkillLevels', items='Level')
33
+ skill_sub_levels: List['SkillSubLevelItem'] = HTField('SkillSubLevels', items='SubLevel')
34
+ player_specialties: 'TranslationListItemValue' = HTField('PlayerSpecialties')
35
+ player_agreeability: 'TranslationListLevelValue' = HTField('PlayerAgreeability')
36
+ player_agressiveness: 'TranslationListLevelValue' = HTField('PlayerAgressiveness')
37
+ player_honesty: 'TranslationListLevelValue' = HTField('PlayerHonesty')
38
+ tactic_types: 'TranslationListItemValue' = HTField('TacticTypes')
39
+ match_positions: 'TranslationListItemType' = HTField('MatchPositions')
40
+ rating_sectors: 'TranslationListItemType' = HTField('RatingSectors')
41
+ team_attitude: 'TranslationListLevelValue' = HTField('TeamAttitude')
42
+ team_spirit: 'TranslationListLevelValue' = HTField('TeamSpirit')
43
+ confidence: 'TranslationListLevelValue' = HTField('Confidence')
44
+ training_types: 'TranslationListItemValue' = HTField('TrainingTypes')
45
+ sponsors: 'TranslationListLevelValue' = HTField('Sponsors')
46
+ fan_mood: 'TranslationListLevelValue' = HTField('FanMood')
47
+ fan_match_expectations: 'TranslationListLevelValue' = HTField('FanMatchExpectations')
48
+ fan_season_expectations: 'TranslationListLevelValue' = HTField('FanSeasonExpectations')
49
+ league_names: List['LeagueItem'] = HTField('LeagueNames', items='League')
50
+
51
+
52
+ class SkillNameItem(HTModel):
53
+ """
54
+ Translations -> Skill Names -> Skill item
55
+ """
56
+ type: str = HTField('.', attrib='Type')
57
+ type_name: str = HTField('.')
58
+
59
+
60
+ class SkillLevelItem(HTModel):
61
+ """
62
+ Translations -> Skill Levels -> Skill item
63
+ """
64
+ value: int = HTField('.', attrib='Value')
65
+ value_name: str = HTField('.')
66
+
67
+
68
+ class SkillSubLevelItem(HTModel):
69
+ """
70
+ Translations -> Skill Levels -> Skill item
71
+ """
72
+ value: float = HTField('.', attrib='Value')
73
+ value_name: str = HTField('.')
74
+
75
+
76
+ class TranslationListItemValue(HTModel):
77
+ """
78
+ Translations -> Translation list - Item-Value
79
+ """
80
+ label: str = HTField('.', attrib='Label')
81
+ list: List['LevelOrItemValue'] = HTField('.', items='Item')
82
+
83
+
84
+ class TranslationListItemType(HTModel):
85
+ """
86
+ Translations -> Translation list - Item-Type
87
+ """
88
+ label: str = HTField('.', attrib='Label')
89
+ list: List['LevelOrItemType'] = HTField('.', items='Item')
90
+
91
+
92
+ class TranslationListLevelValue(HTModel):
93
+ """
94
+ Translations -> Translation list - Level-Value
95
+ """
96
+ label: str = HTField('.', attrib='Label')
97
+ list: List['LevelOrItemValue'] = HTField('.', items='Level')
98
+
99
+
100
+ class LevelOrItemValue(HTModel):
101
+ """
102
+ Translations -> Translation list -> Translation list item - Level or Item with Value
103
+ """
104
+ value: int = HTField('.', attrib='Value')
105
+ label: str = HTField('.')
106
+
107
+
108
+ class LevelOrItemType(HTModel):
109
+ """
110
+ Translations -> Translation list -> Translation list item - Level or Item with Type
111
+ """
112
+ type: str = HTField('.', attrib='Type')
113
+ label: str = HTField('.')
114
+
115
+
116
+ class LeagueItem(HTModel):
117
+ """
118
+ Translations -> League Names -> League item
119
+ """
120
+ id: int = HTField('LeagueId')
121
+ local_name: str = HTField('LocalLeagueName')
122
+ language_name: str = HTField('LanguageLeagueName')
@@ -0,0 +1,52 @@
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 RequestYouthLeagueFixtures(HTModel):
10
+ """
11
+ Youth League Fixtures - Request arguments
12
+ """
13
+ SOURCE_FILE = 'youthleaguefixtures'
14
+ LAST_VERSION = '1.0'
15
+
16
+ _r_youth_league_id: Optional[int] = HTInitVar('youthleagueid', init_arg='youth_league_id')
17
+ _r_season: Optional[int] = HTInitVar('season')
18
+
19
+
20
+ class YouthLeagueFixtures(RequestYouthLeagueFixtures):
21
+ """
22
+ Youth League Fixtures
23
+ """
24
+ id: int = HTField('YouthLeagueID')
25
+ name: str = HTField('YouthLeagueName')
26
+ type: int = HTField('YouthLeagueType')
27
+ season: int = HTField('Season')
28
+ last_match_round: int = HTField('LastMatchRound')
29
+ nr_of_teams_in_league: int = HTField('NrOfTeamsInLeague')
30
+ matches: List['MatchItem'] = HTField('Matches', items='Match')
31
+
32
+
33
+ class MatchItem(HTModel):
34
+ """
35
+ Youth League Fixtures -> Matches -> Match item
36
+ """
37
+ id: int = HTField('MatchID')
38
+ round: int = HTField('MatchRound')
39
+ status: str = HTField('Status')
40
+ home_team: 'Team' = HTField('HomeTeam', xml_prefix='Home')
41
+ away_team: 'Team' = HTField('AwayTeam', xml_prefix='Away')
42
+ date: datetime = HTField('MatchDate')
43
+ home_goals: Optional[int] = HTField('HomeGoals')
44
+ away_goals: Optional[int] = HTField('AwayGoals')
45
+
46
+
47
+ class Team(HTModel):
48
+ """
49
+ Youth League Fixtures -> Matches -> Match item -> Home/Away teams
50
+ """
51
+ id: int = HTField('TeamID')
52
+ name: str = HTField('TeamName')
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "pychpp"
3
- version = "0.4.9"
3
+ version = "0.5.1"
4
4
  description = "framework created to use the API provided by the online game Hattrick"
5
5
  license = "Apache-2.0"
6
6
  authors = ["Pierre Gobin <p.dev@gobin.cc>"]
@@ -10,9 +10,9 @@ homepage = "https://framagit.org/Pierre86/pychpp"
10
10
 
11
11
  [tool.poetry.dependencies]
12
12
  python = "^3.8"
13
- rauth = "^0.7.3"
14
13
  pytz = "^2024.2"
15
14
  Werkzeug = "^2.2.2"
15
+ requests-oauthlib = "^2.0.0"
16
16
 
17
17
  [tool.poetry.group.dev.dependencies]
18
18
  pytest = "^8.3.3"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes