mc5-api-client 1.0.16__py3-none-any.whl → 1.0.18__py3-none-any.whl

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.
@@ -15,18 +15,73 @@ messaging, and more.
15
15
 
16
16
  from typing import Optional, Dict, Any
17
17
 
18
- __version__ = "1.0.16"
18
+ __version__ = "1.0.18"
19
19
  __author__ = "Chizoba"
20
20
  __email__ = "chizoba2026@hotmail.com"
21
21
  __license__ = "MIT"
22
22
 
23
+ from .telemetry import telemetry, report_error, report_usage, is_telemetry_enabled
24
+ from .debug import debug_mode, debug_print, debug_function, analyze_error, print_error_analysis
25
+ from .platform import Platform, get_platform_config, get_android_anonymous_credential, get_pc_anonymous_credential
26
+ from .squad_battle import SquadBattleMixin
27
+ from .transfer_quick import (
28
+ quick_generate_transfer_code,
29
+ quick_check_transfer_status,
30
+ quick_get_device_linking_guide,
31
+ quick_link_device_workflow,
32
+ quick_validate_transfer_code,
33
+ quick_force_new_code,
34
+ quick_transfer_status_summary
35
+ )
36
+ from .account_quick import (
37
+ quick_get_account_info,
38
+ quick_get_device_history,
39
+ quick_get_credential_summary,
40
+ quick_analyze_account_security,
41
+ quick_get_account_overview,
42
+ quick_export_account_data
43
+ )
44
+ from .alerts_quick import (
45
+ quick_start_alert_stream,
46
+ quick_test_alert_connection,
47
+ quick_start_alerts_with_discord,
48
+ quick_monitor_alerts,
49
+ create_alert_callback
50
+ )
51
+ from .federation_quick import (
52
+ quick_get_active_sessions,
53
+ quick_get_my_sessions,
54
+ quick_get_session_statistics,
55
+ quick_check_session_status,
56
+ quick_get_server_type_sessions,
57
+ quick_analyze_session_activity
58
+ )
59
+ from .squad_battle_quick import (
60
+ quick_create_squad_battle_room,
61
+ quick_post_squad_battle_result,
62
+ quick_get_squad_battle_history,
63
+ quick_analyze_squad_performance,
64
+ quick_get_squad_wall_messages,
65
+ quick_send_squad_battle_notification,
66
+ quick_post_squad_wall_message
67
+ )
23
68
  from .simple_client import (
24
69
  SimpleMC5Client,
25
70
  batch_search_players,
26
71
  clan_cleanup,
27
72
  monitor_clan_activity,
28
73
  quick_search,
29
- quick_kick
74
+ quick_kick,
75
+ quick_remove_friend,
76
+ quick_send_friend_request,
77
+ quick_check_friend_status,
78
+ quick_accept_friend_request,
79
+ quick_sign_up_for_event,
80
+ quick_get_event_leaderboard,
81
+ quick_get_my_event_rank,
82
+ quick_get_squad_invitations,
83
+ quick_accept_squad_invitation,
84
+ quick_decline_squad_invitation
30
85
  )
31
86
  from .client import MC5Client
32
87
  from .auth import TokenGenerator
@@ -39,11 +94,185 @@ from .admin_client import (
39
94
  quick_add_squad_rating,
40
95
  quick_update_player_score
41
96
  )
97
+ from .pc_storage_client import PCStorageClient
98
+ from .storage_admin import StorageAdminMixin
99
+ from .easy_mc5 import MC5Easy
42
100
 
43
101
  # Encrypted token convenience functions
44
102
  from .auth import TokenGenerator
45
103
 
46
- def quick_generate_encrypted_token(
104
+ # Convenience functions for global ID operations
105
+ def get_global_id(device_id: str = None, device_type: str = "w10", hdidfv: str = None) -> str:
106
+ """
107
+ Get a global device ID from Gameloft's global ID service.
108
+
109
+ Args:
110
+ device_id: Your device ID (optional, will generate one if not provided)
111
+ device_type: Device type (w10, android, ios, etc.)
112
+ hdidfv: Hardware ID fingerprint (optional)
113
+
114
+ Returns:
115
+ Global device ID string
116
+ """
117
+ import requests
118
+
119
+ # Build request parameters
120
+ params = {
121
+ "source": "Identifiers_6.0.0",
122
+ "client_id": "1875:55979:6.0.0a:windows:windows",
123
+ "device_type": device_type,
124
+ "global_device_id": device_id or "1364509832654538259",
125
+ "hdidfv": hdidfv or "76dfc72e-7850-4d9e-b79c-9861c7e3ea20"
126
+ }
127
+
128
+ headers = {
129
+ "Accept": "*/*",
130
+ "Accept-Encoding": "gzip;q=1.0, deflate;q=1.0, identity;q=0.5, *;q=0"
131
+ }
132
+
133
+ try:
134
+ response = requests.get(
135
+ "https://gdid.datalake.gameloft.com/assign_global_id/",
136
+ params=params,
137
+ headers=headers,
138
+ timeout=30
139
+ )
140
+
141
+ if response.status_code == 200:
142
+ return response.text.strip()
143
+ else:
144
+ return ""
145
+ except Exception:
146
+ return ""
147
+
148
+ def generate_device_id() -> str:
149
+ """
150
+ Generate a unique device ID for the current device.
151
+
152
+ Returns:
153
+ Generated device ID string
154
+ """
155
+ import uuid
156
+
157
+ # Generate a unique device ID
158
+ device_id = f"mc5_{uuid.uuid4().hex[:16]}"
159
+ return device_id
160
+
161
+ def create_federation_session(username: str = None, password: str = None, device_id: str = None) -> Dict[str, Any]:
162
+ """
163
+ Create a federation session for MC5 game launch.
164
+
165
+ Args:
166
+ username: MC5 username (can use MC5_USERNAME env var)
167
+ password: MC5 password (can use MC5_PASSWORD env var)
168
+ device_id: Device ID for the session (optional)
169
+
170
+ Returns:
171
+ Dictionary with session information
172
+ """
173
+ import os
174
+ import requests
175
+
176
+ # Use environment variables if not provided
177
+ username = username or os.getenv('MC5_USERNAME')
178
+ password = password or os.getenv('MC5_PASSWORD')
179
+
180
+ if not username or not password:
181
+ return {"error": "Username and password are required"}
182
+
183
+ try:
184
+ # Build request parameters
185
+ params = {
186
+ "password": password,
187
+ "device_id": device_id or "1364509832654538259"
188
+ }
189
+
190
+ headers = {
191
+ "Accept": "*/*",
192
+ "Content-Type": "application/x-www-form-urlencoded"
193
+ }
194
+
195
+ # Build URL with encoded credential
196
+ encoded_credential = username.replace(":", "%3A")
197
+ url = f"https://federation-eur.gameloft.com/sessions/1875%3A55979%3A6.0.0a%3Awindows%3Awindows/{encoded_credential}"
198
+
199
+ # Make request
200
+ response = requests.post(
201
+ url,
202
+ data=params,
203
+ headers=headers,
204
+ timeout=30
205
+ )
206
+
207
+ if response.status_code == 200:
208
+ return response.json()
209
+ else:
210
+ return {"error": f"HTTP {response.status_code}", "response": response.text}
211
+
212
+ except Exception as e:
213
+ return {"error": str(e)}
214
+
215
+ def locate_service(service: str) -> str:
216
+ """
217
+ Locate a service endpoint for MC5.
218
+
219
+ Args:
220
+ service: Service name (leaderboard, matchmaker, auth, social, alert, message, lobby, gs, sp)
221
+
222
+ Returns:
223
+ Service endpoint URL or empty string if not found
224
+ """
225
+ import requests
226
+
227
+ try:
228
+ # Build request parameters
229
+ params = {
230
+ "service": service,
231
+ "client_id": "1875:55979:6.0.0a:windows:windows"
232
+ }
233
+
234
+ headers = {
235
+ "Accept": "*/*"
236
+ }
237
+
238
+ # Make request
239
+ response = requests.get(
240
+ "https://vgold-eur.gameloft.com/1875:55979:6.0.0a:windows:windows/locate",
241
+ params=params,
242
+ headers=headers,
243
+ timeout=30
244
+ )
245
+
246
+ if response.status_code == 200:
247
+ return response.text.strip()
248
+ else:
249
+ return ""
250
+
251
+ except Exception:
252
+ return ""
253
+
254
+ def get_all_services() -> Dict[str, str]:
255
+ """
256
+ Get all available service endpoints.
257
+
258
+ Returns:
259
+ Dictionary mapping service names to endpoints
260
+ """
261
+ services = [
262
+ "leaderboard", "matchmaker", "auth", "social",
263
+ "alert", "message", "lobby", "gs", "sp"
264
+ ]
265
+
266
+ service_endpoints = {}
267
+
268
+ for service in services:
269
+ endpoint = locate_service(service)
270
+ if endpoint:
271
+ service_endpoints[service] = endpoint
272
+
273
+ return service_endpoints
274
+
275
+ def generate_encrypted_token(
47
276
  username: str,
48
277
  password: str,
49
278
  device_id: Optional[str] = None,
@@ -51,7 +280,7 @@ def quick_generate_encrypted_token(
51
280
  nonce: str = "*"
52
281
  ) -> Dict[str, Any]:
53
282
  """
54
- Quick function to generate and encrypt an access token.
283
+ Generate and encrypt an access token.
55
284
 
56
285
  Args:
57
286
  username: MC5 username
@@ -70,12 +299,12 @@ def quick_generate_encrypted_token(
70
299
  finally:
71
300
  token_gen.close()
72
301
 
73
- def quick_encrypt_token(
302
+ def encrypt_token(
74
303
  access_token: str,
75
304
  nonce: str = "*"
76
305
  ) -> str:
77
306
  """
78
- Quick function to encrypt an existing access token.
307
+ Encrypt an existing access token.
79
308
 
80
309
  Args:
81
310
  access_token: Raw access token string
@@ -100,6 +329,56 @@ __all__ = [
100
329
  "monitor_clan_activity",
101
330
  "quick_search",
102
331
  "quick_kick",
332
+ "quick_remove_friend",
333
+ "quick_send_friend_request",
334
+ "quick_check_friend_status",
335
+ "quick_accept_friend_request",
336
+ "quick_sign_up_for_event",
337
+ "quick_get_event_leaderboard",
338
+ "quick_get_my_event_rank",
339
+ "quick_get_squad_invitations",
340
+ "quick_accept_squad_invitation",
341
+ "quick_decline_squad_invitation",
342
+ "quick_create_squad_battle_room",
343
+ "quick_post_squad_battle_result",
344
+ "quick_get_squad_battle_history",
345
+ "quick_analyze_squad_performance",
346
+ "quick_get_squad_wall_messages",
347
+ "quick_send_squad_battle_notification",
348
+ "quick_post_squad_wall_message",
349
+ "quick_get_active_sessions",
350
+ "quick_get_my_sessions",
351
+ "quick_get_session_statistics",
352
+ "quick_check_session_status",
353
+ "quick_get_server_type_sessions",
354
+ "quick_analyze_session_activity",
355
+ "quick_start_alert_stream",
356
+ "quick_test_alert_connection",
357
+ "quick_start_alerts_with_discord",
358
+ "quick_monitor_alerts",
359
+ "create_alert_callback",
360
+ "quick_get_account_info",
361
+ "quick_get_device_history",
362
+ "quick_get_credential_summary",
363
+ "quick_analyze_account_security",
364
+ "quick_get_account_overview",
365
+ "quick_export_account_data",
366
+ "quick_generate_transfer_code",
367
+ "quick_check_transfer_status",
368
+ "quick_get_device_linking_guide",
369
+ "quick_link_device_workflow",
370
+ "quick_validate_transfer_code",
371
+ "quick_force_new_code",
372
+ "quick_transfer_status_summary",
373
+ "telemetry",
374
+ "report_error",
375
+ "report_usage",
376
+ "is_telemetry_enabled",
377
+ "debug_mode",
378
+ "debug_print",
379
+ "debug_function",
380
+ "analyze_error",
381
+ "print_error_analysis",
103
382
  "create_admin_client",
104
383
  "create_user_client",
105
384
  "quick_add_squad_rating",
@@ -111,6 +390,16 @@ __all__ = [
111
390
  "help",
112
391
  "examples",
113
392
  "quick_reference",
114
- "quick_generate_encrypted_token",
115
- "quick_encrypt_token"
393
+ "generate_encrypted_token",
394
+ "encrypt_token",
395
+ "MC5Easy",
396
+ "quick_connect",
397
+ "check_my_daily_tasks",
398
+ "get_my_mc5_profile",
399
+ "find_mc5_player",
400
+ "get_global_id",
401
+ "generate_device_id",
402
+ "create_federation_session",
403
+ "locate_service",
404
+ "get_all_services"
116
405
  ]