mc5-api-client 1.0.18__tar.gz → 1.0.20__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 (72) hide show
  1. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/PKG-INFO +102 -6
  2. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/README.md +101 -5
  3. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/pyproject.toml +1 -1
  4. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/setup.py +1 -1
  5. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/__init__.py +5 -1
  6. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/client.py +68 -15
  7. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client.egg-info/PKG-INFO +102 -6
  8. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client.egg-info/SOURCES.txt +0 -3
  9. mc5_api_client-1.0.18/CHANGELOG.md +0 -332
  10. mc5_api_client-1.0.18/pytest.ini +0 -16
  11. mc5_api_client-1.0.18/requirements-dev.txt +0 -25
  12. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/.gitignore +0 -0
  13. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/LICENSE +0 -0
  14. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/MANIFEST.in +0 -0
  15. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/admin_squad_management.py +0 -0
  16. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/admin_tools.py +0 -0
  17. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/advanced_automation.py +0 -0
  18. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/advanced_features.py +0 -0
  19. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/authentication_example.py +0 -0
  20. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/basic_usage.py +0 -0
  21. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/clan_management.py +0 -0
  22. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/clan_management_complete.py +0 -0
  23. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/device_id_example.py +0 -0
  24. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/events_and_tasks.py +0 -0
  25. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/everyday_mc5.py +0 -0
  26. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/everyday_mc5_easy.py +0 -0
  27. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/game_launch_example.py +0 -0
  28. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/help_system.py +0 -0
  29. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/message_management.py +0 -0
  30. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/player_stats.py +0 -0
  31. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/private_messaging.py +0 -0
  32. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/quick_help.py +0 -0
  33. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/quick_reference.py +0 -0
  34. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/service_location_example.py +0 -0
  35. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/simple_usage.py +0 -0
  36. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/squad_management.py +0 -0
  37. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/examples/squad_wall_management.py +0 -0
  38. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/requirements.txt +0 -0
  39. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/setup.cfg +0 -0
  40. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/account.py +0 -0
  41. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/account_quick.py +0 -0
  42. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/admin_client.py +0 -0
  43. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/alerts.py +0 -0
  44. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/alerts_quick.py +0 -0
  45. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/auth.py +0 -0
  46. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/cli.py +0 -0
  47. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/debug.py +0 -0
  48. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/easy_mc5.py +0 -0
  49. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/exceptions.py +0 -0
  50. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/federation.py +0 -0
  51. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/federation_quick.py +0 -0
  52. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/help.py +0 -0
  53. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/pc_storage_client.py +0 -0
  54. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/pc_storage_quick.py +0 -0
  55. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/platform.py +0 -0
  56. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/py.typed +0 -0
  57. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/simple_client.py +0 -0
  58. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/squad_battle.py +0 -0
  59. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/squad_battle_quick.py +0 -0
  60. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/storage_admin.py +0 -0
  61. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/telemetry.py +0 -0
  62. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/transfer.py +0 -0
  63. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client/transfer_quick.py +0 -0
  64. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client.egg-info/dependency_links.txt +0 -0
  65. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client.egg-info/entry_points.txt +0 -0
  66. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client.egg-info/not-zip-safe +0 -0
  67. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client.egg-info/requires.txt +0 -0
  68. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/src/mc5_api_client.egg-info/top_level.txt +0 -0
  69. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/tests/__init__.py +0 -0
  70. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/tests/test_auth.py +0 -0
  71. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/tests/test_cli.py +0 -0
  72. {mc5_api_client-1.0.18 → mc5_api_client-1.0.20}/tests/test_client.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mc5_api_client
3
- Version: 1.0.18
3
+ Version: 1.0.20
4
4
  Summary: A comprehensive Python library for interacting with the Modern Combat 5 API
5
5
  Home-page: https://pypi.org/project/mc5-api-client/
6
6
  Author: Chizoba
@@ -143,10 +143,109 @@ Think of this as your remote control for Modern Combat 5! Here's what you can do
143
143
  ### 🎉 MC5 API Client v1.0.18 - Super Easy Interface & Clean API!
144
144
 
145
145
  ```bash
146
- pip install mc5_api_client==1.0.18
146
+ pip install mc5_api_client==1.0.20
147
147
  ```
148
148
 
149
- ### **Major Features Completed!**
149
+ ## 🎯 **Usage Examples**
150
+
151
+ ### **🎮 Basic Usage (MC5Client)**
152
+ ```python
153
+ from mc5_api_client import MC5Client
154
+
155
+ # Initialize the client
156
+ client = MC5Client(
157
+ client_id="1875:55979:6.0.0a:windows:windows",
158
+ username="your_credential",
159
+ password="your_password"
160
+ )
161
+
162
+ # Authenticate
163
+ client.authenticate()
164
+
165
+ # Get profile
166
+ profile = client.get_profile()
167
+ print(f"Profile: {profile}")
168
+
169
+ # Get events
170
+ events = client.get_events()
171
+ print(f"Events: {len(events)} found")
172
+
173
+ # Server status (NEW!)
174
+ status = client.get_server_status()
175
+ print(f"Server Status: {status['status']}")
176
+
177
+ # Close connection
178
+ client.close()
179
+ ```
180
+
181
+ ### **🎯 MC5ApiClient (Backward Compatible)**
182
+ ```python
183
+ from mc5_api_client import MC5ApiClient
184
+
185
+ # MC5ApiClient is an alias for MC5Client
186
+ client = MC5ApiClient(
187
+ client_id="1875:55979:6.0.0a:windows:windows",
188
+ username="your_credential",
189
+ password="your_password"
190
+ )
191
+
192
+ # Use the same methods as MC5Client
193
+ client.authenticate()
194
+ status = client.get_server_status()
195
+ info = client.get_server_info()
196
+ ```
197
+
198
+ ### **🔧 Quick Functions (Standalone)**
199
+ ```python
200
+ from mc5_api_client import quick_get_account_info, quick_get_active_sessions
201
+
202
+ # Quick functions are standalone, not client methods
203
+ # They require credentials as parameters
204
+ account_info = quick_get_account_info("your_credential", "your_password")
205
+ sessions = quick_get_active_sessions("your_password")
206
+ ```
207
+
208
+ ### **🎮 Game Launch & Service Location (NEW!)**
209
+ ```python
210
+ from mc5_api_client import MC5Easy, get_all_services, create_federation_session
211
+
212
+ # Get all MC5 services dynamically
213
+ services = get_all_services()
214
+ print(f"Found {len(services)} services:")
215
+ for service, endpoint in services.items():
216
+ print(f" {service}: {endpoint}")
217
+
218
+ # Create federation session for game launch
219
+ session = create_federation_session(username, password)
220
+ if session.get("success"):
221
+ print(f"Room ID: {session['room_id']}")
222
+ print(f"Controller: {session['controller_host']}")
223
+
224
+ # Or use MC5Easy for complete game management
225
+ with MC5Easy(username, password) as mc5:
226
+ launch_info = mc5.launch_game_session()
227
+ print(f"Game ready: {launch_info['launch_command']}")
228
+ ```
229
+
230
+ ### **🌐 Global ID & Device Management (NEW!)**
231
+ ```python
232
+ from mc5_api_client import get_global_id, generate_device_id
233
+
234
+ # Get global device ID
235
+ global_id = get_global_id()
236
+ print(f"Global ID: {global_id}")
237
+
238
+ # Generate unique device ID
239
+ device_id = generate_device_id()
240
+ print(f"Device ID: {device_id}")
241
+
242
+ # With MC5Easy
243
+ with MC5Easy(username, password) as mc5:
244
+ device_info = mc5.get_device_info()
245
+ print(f"Device: {device_info}")
246
+ ```
247
+
248
+ ## 📱 **Run Examples:** Completed!
150
249
 
151
250
  **🎯 Super Easy Interface (NEW in v1.0.18):**
152
251
  - ✅ **MC5Easy Module** - One-line functions for everyday tasks
@@ -1348,8 +1447,6 @@ finally:
1348
1447
  **Security Benefits:**
1349
1448
  - ✅ **Additional Layer**: Tokens are encrypted before transmission
1350
1449
  - ✅ **Custom Nonce**: Support for custom nonce values
1351
- - ✅ **Backward Compatible**: Works with existing authentication flow
1352
- - ✅ **Error Handling**: Proper validation and error recovery
1353
1450
 
1354
1451
  ### 🏆 **Checking Leaderboards**
1355
1452
 
@@ -1369,7 +1466,6 @@ if hasattr(client, 'get_leaderboard'):
1369
1466
  # print(f"Top {len(leaderboard.get('players', []))} players")
1370
1467
  else:
1371
1468
  print("❌ get_leaderboard method not found")
1372
- ```
1373
1469
 
1374
1470
  ### 🖥️ CLI Commands - Currently Available
1375
1471
 
@@ -65,10 +65,109 @@ Think of this as your remote control for Modern Combat 5! Here's what you can do
65
65
  ### 🎉 MC5 API Client v1.0.18 - Super Easy Interface & Clean API!
66
66
 
67
67
  ```bash
68
- pip install mc5_api_client==1.0.18
68
+ pip install mc5_api_client==1.0.20
69
69
  ```
70
70
 
71
- ### **Major Features Completed!**
71
+ ## 🎯 **Usage Examples**
72
+
73
+ ### **🎮 Basic Usage (MC5Client)**
74
+ ```python
75
+ from mc5_api_client import MC5Client
76
+
77
+ # Initialize the client
78
+ client = MC5Client(
79
+ client_id="1875:55979:6.0.0a:windows:windows",
80
+ username="your_credential",
81
+ password="your_password"
82
+ )
83
+
84
+ # Authenticate
85
+ client.authenticate()
86
+
87
+ # Get profile
88
+ profile = client.get_profile()
89
+ print(f"Profile: {profile}")
90
+
91
+ # Get events
92
+ events = client.get_events()
93
+ print(f"Events: {len(events)} found")
94
+
95
+ # Server status (NEW!)
96
+ status = client.get_server_status()
97
+ print(f"Server Status: {status['status']}")
98
+
99
+ # Close connection
100
+ client.close()
101
+ ```
102
+
103
+ ### **🎯 MC5ApiClient (Backward Compatible)**
104
+ ```python
105
+ from mc5_api_client import MC5ApiClient
106
+
107
+ # MC5ApiClient is an alias for MC5Client
108
+ client = MC5ApiClient(
109
+ client_id="1875:55979:6.0.0a:windows:windows",
110
+ username="your_credential",
111
+ password="your_password"
112
+ )
113
+
114
+ # Use the same methods as MC5Client
115
+ client.authenticate()
116
+ status = client.get_server_status()
117
+ info = client.get_server_info()
118
+ ```
119
+
120
+ ### **🔧 Quick Functions (Standalone)**
121
+ ```python
122
+ from mc5_api_client import quick_get_account_info, quick_get_active_sessions
123
+
124
+ # Quick functions are standalone, not client methods
125
+ # They require credentials as parameters
126
+ account_info = quick_get_account_info("your_credential", "your_password")
127
+ sessions = quick_get_active_sessions("your_password")
128
+ ```
129
+
130
+ ### **🎮 Game Launch & Service Location (NEW!)**
131
+ ```python
132
+ from mc5_api_client import MC5Easy, get_all_services, create_federation_session
133
+
134
+ # Get all MC5 services dynamically
135
+ services = get_all_services()
136
+ print(f"Found {len(services)} services:")
137
+ for service, endpoint in services.items():
138
+ print(f" {service}: {endpoint}")
139
+
140
+ # Create federation session for game launch
141
+ session = create_federation_session(username, password)
142
+ if session.get("success"):
143
+ print(f"Room ID: {session['room_id']}")
144
+ print(f"Controller: {session['controller_host']}")
145
+
146
+ # Or use MC5Easy for complete game management
147
+ with MC5Easy(username, password) as mc5:
148
+ launch_info = mc5.launch_game_session()
149
+ print(f"Game ready: {launch_info['launch_command']}")
150
+ ```
151
+
152
+ ### **🌐 Global ID & Device Management (NEW!)**
153
+ ```python
154
+ from mc5_api_client import get_global_id, generate_device_id
155
+
156
+ # Get global device ID
157
+ global_id = get_global_id()
158
+ print(f"Global ID: {global_id}")
159
+
160
+ # Generate unique device ID
161
+ device_id = generate_device_id()
162
+ print(f"Device ID: {device_id}")
163
+
164
+ # With MC5Easy
165
+ with MC5Easy(username, password) as mc5:
166
+ device_info = mc5.get_device_info()
167
+ print(f"Device: {device_info}")
168
+ ```
169
+
170
+ ## 📱 **Run Examples:** Completed!
72
171
 
73
172
  **🎯 Super Easy Interface (NEW in v1.0.18):**
74
173
  - ✅ **MC5Easy Module** - One-line functions for everyday tasks
@@ -1270,8 +1369,6 @@ finally:
1270
1369
  **Security Benefits:**
1271
1370
  - ✅ **Additional Layer**: Tokens are encrypted before transmission
1272
1371
  - ✅ **Custom Nonce**: Support for custom nonce values
1273
- - ✅ **Backward Compatible**: Works with existing authentication flow
1274
- - ✅ **Error Handling**: Proper validation and error recovery
1275
1372
 
1276
1373
  ### 🏆 **Checking Leaderboards**
1277
1374
 
@@ -1291,7 +1388,6 @@ if hasattr(client, 'get_leaderboard'):
1291
1388
  # print(f"Top {len(leaderboard.get('players', []))} players")
1292
1389
  else:
1293
1390
  print("❌ get_leaderboard method not found")
1294
- ```
1295
1391
 
1296
1392
  ### 🖥️ CLI Commands - Currently Available
1297
1393
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "mc5_api_client"
7
- version = "1.0.18"
7
+ version = "1.0.20"
8
8
  description = "A comprehensive Python library for interacting with the Modern Combat 5 API"
9
9
  readme = "README.md"
10
10
  license = {file = "LICENSE"}
@@ -33,7 +33,7 @@ def read_requirements():
33
33
  setup(
34
34
  name="mc5_api_client",
35
35
  use_scm_version=False,
36
- version="1.0.18",
36
+ version="1.0.20",
37
37
  description="A comprehensive Python library for interacting with the Modern Combat 5 API",
38
38
  long_description=read_readme(),
39
39
  long_description_content_type="text/markdown",
@@ -15,7 +15,7 @@ messaging, and more.
15
15
 
16
16
  from typing import Optional, Dict, Any
17
17
 
18
- __version__ = "1.0.18"
18
+ __version__ = "1.0.20"
19
19
  __author__ = "Chizoba"
20
20
  __email__ = "chizoba2026@hotmail.com"
21
21
  __license__ = "MIT"
@@ -87,6 +87,9 @@ from .client import MC5Client
87
87
  from .auth import TokenGenerator
88
88
  from .exceptions import MC5APIError, AuthenticationError, RateLimitError
89
89
  from .help import help, examples, quick_reference
90
+
91
+ # Add MC5ApiClient as an alias for backward compatibility
92
+ MC5ApiClient = MC5Client
90
93
  from .admin_client import (
91
94
  AdminMC5Client,
92
95
  create_admin_client,
@@ -322,6 +325,7 @@ def encrypt_token(
322
325
 
323
326
  __all__ = [
324
327
  "MC5Client",
328
+ "MC5ApiClient",
325
329
  "SimpleMC5Client",
326
330
  "AdminMC5Client",
327
331
  "batch_search_players",
@@ -1573,31 +1573,84 @@ class MC5Client(SquadBattleMixin, FederationMixin, AlertsMixin, AccountMixin, Tr
1573
1573
 
1574
1574
  # Utility Methods
1575
1575
 
1576
- def get_token_info(self) -> Dict[str, Any]:
1576
+ def close(self):
1577
+ """Close the HTTP session and cleanup resources."""
1578
+ if self.session:
1579
+ self.session.close()
1580
+ if self.token_generator:
1581
+ self.token_generator.close()
1582
+
1583
+ # Server Status Methods (for compatibility)
1584
+
1585
+ def get_server_status(self) -> Dict[str, Any]:
1577
1586
  """
1578
- Get current token information.
1587
+ Get server status information.
1579
1588
 
1580
1589
  Returns:
1581
- Token data
1590
+ Dictionary with server status
1582
1591
  """
1583
- self._ensure_valid_token()
1584
- return self._token_data.copy()
1592
+ try:
1593
+ # Try to get events as a basic connectivity test
1594
+ events = self.get_events()
1595
+ return {
1596
+ "status": "online",
1597
+ "message": "MC5 servers are online",
1598
+ "events_count": len(events),
1599
+ "timestamp": time.time()
1600
+ }
1601
+ except Exception as e:
1602
+ return {
1603
+ "status": "offline",
1604
+ "message": f"Server status check failed: {str(e)}",
1605
+ "timestamp": time.time()
1606
+ }
1585
1607
 
1586
- def is_authenticated(self) -> bool:
1608
+ def get_online_players(self) -> Dict[str, Any]:
1587
1609
  """
1588
- Check if client is authenticated with valid token.
1610
+ Get online players information (estimated).
1589
1611
 
1590
1612
  Returns:
1591
- True if authenticated, False otherwise
1613
+ Dictionary with online player count
1592
1614
  """
1593
- return self._token_data is not None and self.token_generator.validate_token(self._token_data)
1615
+ try:
1616
+ # Get events as a proxy for activity
1617
+ events = self.get_events()
1618
+ # This is an estimate - actual player count isn't directly available
1619
+ return {
1620
+ "online_players": "Unknown",
1621
+ "active_events": len(events),
1622
+ "message": "Player count not directly available via API",
1623
+ "timestamp": time.time()
1624
+ }
1625
+ except Exception as e:
1626
+ return {
1627
+ "online_players": 0,
1628
+ "error": str(e),
1629
+ "timestamp": time.time()
1630
+ }
1594
1631
 
1595
- def close(self):
1596
- """Close the HTTP session and cleanup resources."""
1597
- if self.session:
1598
- self.session.close()
1599
- if self.token_generator:
1600
- self.token_generator.close()
1632
+ def get_server_info(self) -> Dict[str, Any]:
1633
+ """
1634
+ Get general server information.
1635
+
1636
+ Returns:
1637
+ Dictionary with server information
1638
+ """
1639
+ try:
1640
+ return {
1641
+ "server": "Modern Combat 5",
1642
+ "region": "Europe",
1643
+ "api_version": "1.0.18",
1644
+ "endpoints": list(self.BASE_URLS.keys()),
1645
+ "client_id": self.client_id,
1646
+ "authenticated": bool(self.access_token),
1647
+ "timestamp": time.time()
1648
+ }
1649
+ except Exception as e:
1650
+ return {
1651
+ "error": str(e),
1652
+ "timestamp": time.time()
1653
+ }
1601
1654
 
1602
1655
  # Events API
1603
1656
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mc5_api_client
3
- Version: 1.0.18
3
+ Version: 1.0.20
4
4
  Summary: A comprehensive Python library for interacting with the Modern Combat 5 API
5
5
  Home-page: https://pypi.org/project/mc5-api-client/
6
6
  Author: Chizoba
@@ -143,10 +143,109 @@ Think of this as your remote control for Modern Combat 5! Here's what you can do
143
143
  ### 🎉 MC5 API Client v1.0.18 - Super Easy Interface & Clean API!
144
144
 
145
145
  ```bash
146
- pip install mc5_api_client==1.0.18
146
+ pip install mc5_api_client==1.0.20
147
147
  ```
148
148
 
149
- ### **Major Features Completed!**
149
+ ## 🎯 **Usage Examples**
150
+
151
+ ### **🎮 Basic Usage (MC5Client)**
152
+ ```python
153
+ from mc5_api_client import MC5Client
154
+
155
+ # Initialize the client
156
+ client = MC5Client(
157
+ client_id="1875:55979:6.0.0a:windows:windows",
158
+ username="your_credential",
159
+ password="your_password"
160
+ )
161
+
162
+ # Authenticate
163
+ client.authenticate()
164
+
165
+ # Get profile
166
+ profile = client.get_profile()
167
+ print(f"Profile: {profile}")
168
+
169
+ # Get events
170
+ events = client.get_events()
171
+ print(f"Events: {len(events)} found")
172
+
173
+ # Server status (NEW!)
174
+ status = client.get_server_status()
175
+ print(f"Server Status: {status['status']}")
176
+
177
+ # Close connection
178
+ client.close()
179
+ ```
180
+
181
+ ### **🎯 MC5ApiClient (Backward Compatible)**
182
+ ```python
183
+ from mc5_api_client import MC5ApiClient
184
+
185
+ # MC5ApiClient is an alias for MC5Client
186
+ client = MC5ApiClient(
187
+ client_id="1875:55979:6.0.0a:windows:windows",
188
+ username="your_credential",
189
+ password="your_password"
190
+ )
191
+
192
+ # Use the same methods as MC5Client
193
+ client.authenticate()
194
+ status = client.get_server_status()
195
+ info = client.get_server_info()
196
+ ```
197
+
198
+ ### **🔧 Quick Functions (Standalone)**
199
+ ```python
200
+ from mc5_api_client import quick_get_account_info, quick_get_active_sessions
201
+
202
+ # Quick functions are standalone, not client methods
203
+ # They require credentials as parameters
204
+ account_info = quick_get_account_info("your_credential", "your_password")
205
+ sessions = quick_get_active_sessions("your_password")
206
+ ```
207
+
208
+ ### **🎮 Game Launch & Service Location (NEW!)**
209
+ ```python
210
+ from mc5_api_client import MC5Easy, get_all_services, create_federation_session
211
+
212
+ # Get all MC5 services dynamically
213
+ services = get_all_services()
214
+ print(f"Found {len(services)} services:")
215
+ for service, endpoint in services.items():
216
+ print(f" {service}: {endpoint}")
217
+
218
+ # Create federation session for game launch
219
+ session = create_federation_session(username, password)
220
+ if session.get("success"):
221
+ print(f"Room ID: {session['room_id']}")
222
+ print(f"Controller: {session['controller_host']}")
223
+
224
+ # Or use MC5Easy for complete game management
225
+ with MC5Easy(username, password) as mc5:
226
+ launch_info = mc5.launch_game_session()
227
+ print(f"Game ready: {launch_info['launch_command']}")
228
+ ```
229
+
230
+ ### **🌐 Global ID & Device Management (NEW!)**
231
+ ```python
232
+ from mc5_api_client import get_global_id, generate_device_id
233
+
234
+ # Get global device ID
235
+ global_id = get_global_id()
236
+ print(f"Global ID: {global_id}")
237
+
238
+ # Generate unique device ID
239
+ device_id = generate_device_id()
240
+ print(f"Device ID: {device_id}")
241
+
242
+ # With MC5Easy
243
+ with MC5Easy(username, password) as mc5:
244
+ device_info = mc5.get_device_info()
245
+ print(f"Device: {device_info}")
246
+ ```
247
+
248
+ ## 📱 **Run Examples:** Completed!
150
249
 
151
250
  **🎯 Super Easy Interface (NEW in v1.0.18):**
152
251
  - ✅ **MC5Easy Module** - One-line functions for everyday tasks
@@ -1348,8 +1447,6 @@ finally:
1348
1447
  **Security Benefits:**
1349
1448
  - ✅ **Additional Layer**: Tokens are encrypted before transmission
1350
1449
  - ✅ **Custom Nonce**: Support for custom nonce values
1351
- - ✅ **Backward Compatible**: Works with existing authentication flow
1352
- - ✅ **Error Handling**: Proper validation and error recovery
1353
1450
 
1354
1451
  ### 🏆 **Checking Leaderboards**
1355
1452
 
@@ -1369,7 +1466,6 @@ if hasattr(client, 'get_leaderboard'):
1369
1466
  # print(f"Top {len(leaderboard.get('players', []))} players")
1370
1467
  else:
1371
1468
  print("❌ get_leaderboard method not found")
1372
- ```
1373
1469
 
1374
1470
  ### 🖥️ CLI Commands - Currently Available
1375
1471
 
@@ -1,11 +1,8 @@
1
1
  .gitignore
2
- CHANGELOG.md
3
2
  LICENSE
4
3
  MANIFEST.in
5
4
  README.md
6
5
  pyproject.toml
7
- pytest.ini
8
- requirements-dev.txt
9
6
  requirements.txt
10
7
  setup.py
11
8
  examples/admin_squad_management.py
@@ -1,332 +0,0 @@
1
- # Changelog
2
-
3
- All notable changes to this project will be documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
- and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
8
- ## [1.0.8] - 2026-02-03
9
-
10
- ### 🤖 Major Release - Advanced Automation & Loop-Based Operations
11
-
12
- #### 🔄 Revolutionary Loop-Based Operations
13
- - ✅ **Batch Search**: Search multiple players with automatic loops and conditional processing
14
- - ✅ **Smart Clan Cleanup**: Intelligent member management with safety checks and conditional logic
15
- - ✅ **Real-time Monitoring**: While loops for continuous clan activity tracking with alerts
16
- - ✅ **Automated Workflows**: Complete automation sequences with decision-making capabilities
17
- - ✅ **Conditional Processing**: Smart filtering based on player stats, level, and activity
18
-
19
- #### 🧠 Advanced Conditional Logic System
20
- - ✅ **Safety Checks**: Protect high-level members (configurable level thresholds)
21
- - ✅ **Role Protection**: Safeguard leaders, admins, and officers from automated actions
22
- - ✅ **Dynamic Decisions**: Make intelligent choices based on clan composition and statistics
23
- - ✅ **Error Recovery**: Graceful handling of failures with continue/break logic
24
- - ✅ **Smart Filtering**: Categorize members automatically (elite, active, veterans, newbies, inactive)
25
-
26
- #### 📊 New Advanced Functions
27
- - ✅ **batch_search_players()**: Search multiple dogtags with loop and conditional processing
28
- - ✅ **clan_cleanup()**: Comprehensive clan analysis with intelligent recommendations
29
- - ✅ **monitor_clan_activity()**: Real-time monitoring with while loops and conditional alerts
30
- - ✅ **get_inactive_members()**: Identify inactive members with configurable criteria
31
- - ✅ **auto_kick_inactive_members()**: Safe automated kicking with dry-run mode
32
-
33
- #### 🎯 Advanced Use Cases Enabled
34
- - ✅ **Elite Player Recruitment**: Batch search and filter for high-kill players
35
- - ✅ **Clan Health Analysis**: Calculate health scores and provide recommendations
36
- - ✅ **Activity Trend Monitoring**: Track clan activity patterns over time
37
- - ✅ **Automated Member Management**: Smart categorization and processing
38
- - ✅ **Performance Metrics**: Statistical analysis and reporting
39
-
40
- #### 🔧 Technical Improvements
41
- - ✅ **Enhanced Error Handling**: Robust try-catch blocks with graceful recovery
42
- - ✅ **Memory Management**: Automatic cleanup and resource management
43
- - ✅ **Performance Optimization**: Efficient batch processing and lazy loading
44
- - ✅ **Safety Features**: Dry-run modes and protection mechanisms
45
- - ✅ **Documentation**: Complete examples and advanced usage guides
46
-
47
- #### 📚 Comprehensive Documentation
48
- - ✅ **Advanced Examples**: Complete automation examples with loops and conditionals
49
- - ✅ **Use Case Scenarios**: Real-world applications for clan management
50
- - ✅ **Safety Guidelines**: Best practices for automated operations
51
- - ✅ **Technical Reference**: Detailed function documentation
52
-
53
- #### 🎮 Real-World Automation Examples
54
- ```python
55
- # Batch search with conditional logic
56
- results = batch_search_players(['f55f', '9gg9', '218f'], username, password)
57
- for player in results['found']:
58
- if player['kills'] > 10000:
59
- print(f"🌟 Elite: {player['dogtag']} - {player['kills']:,} kills")
60
-
61
- # Smart clan cleanup with safety
62
- results = clan_cleanup(username, password, inactive_days=30, min_level=15, dry_run=True)
63
- if results['would_kick'] > 0:
64
- print("⚠️ Consider removing inactive members")
65
-
66
- # Real-time monitoring with while loops
67
- monitor_clan_activity(username, password, check_interval=60, max_checks=10)
68
- ```
69
-
70
- #### 🛡️ Safety & Protection Features
71
- - ✅ **Dry Run Mode**: Test operations without executing actual changes
72
- - ✅ **Level Thresholds**: Configurable minimum level protection
73
- - ✅ **Role Protection**: Automatic safeguarding of important clan roles
74
- - ✅ **Conditional Logic**: Smart decision-making to prevent mistakes
75
- - ✅ **Error Boundaries**: Isolated failure handling for individual operations
76
-
77
- ---
78
-
79
- ### 🎮 Major Release - User-Friendly Interface for Non-Developers
80
-
81
- #### 🌟 SimpleMC5Client - Revolutionary Easy Interface
82
- - ✅ **New SimpleMC5Client**: Designed specifically for non-developers
83
- - ✅ **Auto-Clan Detection**: Automatically finds clan ID from user profile
84
- - ✅ **Simplified Method Names**: `search_player()` instead of `get_player_stats_by_dogtag()`
85
- - ✅ **One-Liner Functions**: `quick_search()` and `quick_kick()` for instant results
86
- - ✅ **Context Manager Support**: Automatic cleanup with `with` statements
87
- - ✅ **Lazy Authentication**: Only connects when needed, not on initialization
88
- - ✅ **User-Friendly Error Messages**: Clear, helpful explanations for beginners
89
-
90
- #### 📚 Comprehensive Documentation for Beginners
91
- - ✅ **User Friendly Guide**: Complete beginner's guide with step-by-step instructions
92
- - ✅ **Simple Usage Examples**: Copy-paste ready code for common tasks
93
- - ✅ **Syntax Comparison Table**: Simple vs Advanced methods side-by-side
94
- - ✅ **FAQ Section**: Common questions and answers for non-developers
95
- - ✅ **Real-World Examples**: Clan management, player search, messaging
96
-
97
- #### 🎯 Perfect for Non-Technical Users
98
- - ✅ **Clan Leaders**: Easy member management without technical knowledge
99
- - ✅ **Players**: Quick stats lookup with just a dogtag
100
- - ✅ **Beginners**: No programming experience required
101
- - ✅ **Quick Tasks**: One-liner functions for common operations
102
-
103
- #### 📊 Simple vs Advanced Comparison
104
- | Task | Simple Version | Advanced Version |
105
- |------|----------------|------------------|
106
- | Search Player | `client.search_player('f55f')` | `client.get_player_stats_by_dogtag('f55f')` |
107
- | Get Clan Members | `client.get_clan_members()` | `client.get_clan_members(clan_id)` |
108
- | Kick Member | `client.kick_member('9gg9')` | `client.kick_clan_member_by_dogtag('9gg9', clan_id)` |
109
- | Connect | `client.connect()` | Manual authentication |
110
-
111
- #### 🔧 Technical Improvements
112
- - ✅ **Backward Compatibility**: All existing advanced features still available
113
- - ✅ **Graceful Error Handling**: User-friendly error messages
114
- - ✅ **Memory Management**: Automatic connection cleanup
115
- - ✅ **Import Updates**: SimpleMC5Client added to main package exports
116
-
117
- #### 🎮 Real-World Usage Examples
118
- ```python
119
- # Super simple - just 3 lines!
120
- from mc5_api_client import SimpleMC5Client
121
- client = SimpleMC5Client('YOUR_USERNAME', 'YOUR_PASSWORD')
122
- client.connect()
123
- player = client.search_player('f55f')
124
-
125
- # One-liner search
126
- from mc5_api_client import quick_search
127
- player = quick_search('218f', 'YOUR_USERNAME', 'YOUR_PASSWORD')
128
-
129
- # Easy clan management
130
- with SimpleMC5Client('YOUR_USERNAME', 'YOUR_PASSWORD') as client:
131
- client.connect() # Auto-finds your clan!
132
- members = client.get_clan_members()
133
- client.kick_member('9gg9', 'Inactive for 30 days')
134
- ```
135
-
136
- ---
137
-
138
- ## [1.0.5] - 2026-02-03
139
-
140
- ### 🔧 Critical Bug Fix
141
-
142
- #### 🌐 Fixed Missing API Endpoint
143
- - ✅ Added missing `janus` URL to BASE_URLS configuration
144
- - ✅ Fixed player lookup by alias/dogtag functionality
145
- - ✅ Resolved `'janus'` KeyError in alias lookup methods
146
- - ✅ All batch profile functionality now working correctly
147
-
148
- #### 🧪 Verified Functionality
149
- - ✅ Dogtag to alias conversion: f55f → d33d ✅
150
- - ✅ Player lookup by alias: Working perfectly ✅
151
- - ✅ Batch profile retrieval: Successfully tested ✅
152
- - ✅ Dogtag search with stats: Rating 800, K/D 14.75 ✅
153
- - ✅ Statistics parsing: All data structured correctly ✅
154
-
155
- #### 📚 Updated Documentation
156
- - ✅ Added dogtag search example to quick start guide
157
- - ✅ Enhanced README with working batch profile examples
158
- - ✅ Updated feature list with verified functionality
159
- - ✅ Added real test results to documentation
160
-
161
- #### 🎯 Real-World Test Results
162
- - **Test Player**: Dogtag f55f → Alias d33d
163
- - **Rating**: 800
164
- - **K/D Ratio**: 14.75 (Excellent!)
165
- - **Total Kills**: 59
166
- - **Total Headshots**: 16
167
- - **XP**: 4,439
168
- - **Account ID**: 9f2905fe-d346-11ef-8471-b8ca3a67cd10
169
-
170
- ## [1.0.4] - 2026-02-03
171
-
172
- ### 🚀 Player Statistics & Batch Profiles Feature
173
-
174
- #### 📊 Batch Profile System (6+ Methods)
175
- - ✅ Get batch player profiles with detailed statistics and game save data
176
- - ✅ Search players by dogtag (in-game ID) with automatic alias conversion
177
- - ✅ Get detailed player statistics using credentials
178
- - ✅ Parse and structure player statistics for easy consumption
179
- - ✅ Combine alias lookup with stats retrieval
180
- - ✅ Support for multiple player batch operations
181
- - ✅ Access detailed game save data including progress, loadouts, weapons
182
- - ✅ Weapon statistics and performance analysis
183
- - ✅ Campaign progress tracking
184
- - ✅ Overall statistics calculation (K/D ratios, accuracy, etc.)
185
- - ✅ Player performance analysis tools
186
-
187
- #### 🏷️ Enhanced Alias/Dogtags Integration
188
- - ✅ Seamless integration between dogtag conversion and player lookup
189
- - ✅ Automatic dogtag to alias conversion for API calls
190
- - ✅ Combined dogtag search with detailed statistics retrieval
191
- - ✅ Enhanced error handling for invalid dogtags
192
- - ✅ Support for all dogtag formats with validation
193
-
194
- #### 📚 New Example Script
195
- - ✅ Added `examples/player_stats.py` with comprehensive demonstrations
196
- - ✅ Real-world usage scenarios for player analytics
197
- - ✅ Performance analysis and weapon statistics examples
198
- - ✅ Batch operations and multi-player lookup examples
199
- - ✅ Advanced usage patterns for player data analysis
200
-
201
- #### 📖 Enhanced Documentation
202
- - ✅ Added Player Statistics section to README
203
- - ✅ Detailed usage examples for batch profiles
204
- - ✅ Integration examples with alias/dogtag system
205
- - ✅ Performance analysis and statistics parsing examples
206
- - ✅ Updated feature list with new batch profile methods
207
-
208
- #### 🔧 Code Quality Improvements
209
- - ✅ Comprehensive error handling for batch operations
210
- - ✅ Robust data parsing and validation
211
- - ✅ Type hints for all new methods
212
- - ✅ Detailed docstrings with examples
213
- - ✅ Support for edge cases and malformed data
214
-
215
- #### 🧪 Testing & Validation
216
- - ✅ All new methods tested with real API endpoints
217
- - ✅ Error scenarios handled gracefully
218
- - ✅ Performance optimization for batch operations
219
- - ✅ Memory-efficient data parsing
220
-
221
- ### 📋 Technical Details
222
-
223
- #### 🌐 New API Endpoint Integration
224
- - **Endpoint**: `https://app-468561b3-9ecd-4d21-8241-30ed288f4d8b.gold0009.gameloft.com/1875/windows/09/public/OfficialScripts/mc5Portal.wsgi`
225
- - **Method**: POST with form-encoded data
226
- - **Operation**: `get_batch_profiles`
227
- - **Fields**: `_game_save`, `inventory` (configurable)
228
- - **Authentication**: Uses existing client authentication
229
-
230
- #### 🔄 Dogtag to Alias Conversion
231
- - **Mathematical Algorithm**: Letters (ASCII -2), Digits (mod 10 arithmetic)
232
- - **Validation**: Automatic format detection and error handling
233
- - **Integration**: Seamless conversion for API compatibility
234
- - **Examples**: f55f → d33d, ff11 → dd99, g6765 → e4543
235
-
236
- #### 📊 Data Structure Parsing
237
- - **Game Save Data**: Rating, progress, loadouts, statistics
238
- - **Inventory Data**: XP, VIP points, weapon statistics
239
- - **Weapon Stats**: Kills, shots, hits, accuracy, time used
240
- - **Overall Stats**: K/D ratios, headshot percentages, time played
241
-
242
- ## [1.0.3] - 2026-02-02
243
-
244
- ### Added
245
- - Initial release of MC5 API Client by Chizoba
246
- - Comprehensive authentication system with token generation
247
- - Support for both user and admin authentication
248
- - Modern CLI interface with Rich formatting and debug capabilities
249
- - Full API coverage including:
250
- - Profile management
251
- - Clan operations
252
- - Friend management
253
- - Messaging system
254
- - Events and tasks
255
- - Leaderboard access
256
- - Game objects
257
- - Asset metadata
258
- - Alias lookup
259
- - Automatic token refresh functionality
260
- - Comprehensive error handling with custom exceptions
261
- - Type hints throughout the codebase
262
- - Extensive documentation and examples
263
- - Unit test coverage
264
- - PyPI package configuration
265
- - Development environment setup
266
- - Python 3.11+ support (beta version)
267
-
268
- ### Features
269
- - **Authentication**: Easy token generation and management
270
- - **CLI**: Rich command-line interface with progress indicators
271
- - **Auto-refresh**: Automatic token renewal
272
- - **Error Handling**: Comprehensive exception hierarchy
273
- - **Type Safety**: Full type annotation support
274
- - **Documentation**: Detailed README and examples
275
- - **Testing**: Unit tests with mocking
276
- - **Configuration**: Persistent config and token storage
277
-
278
- ### CLI Commands
279
- - `generate-token` - Generate user access tokens
280
- - `generate-admin-token` - Generate admin access tokens
281
- - `validate-token` - Validate saved tokens
282
- - `show-config` - Display configuration
283
- - `clear-config` - Clear saved data
284
-
285
- ### API Endpoints Supported
286
- - Authentication (Janus)
287
- - Profile management (Osiris)
288
- - Clan operations (Osiris)
289
- - Friend system (Osiris)
290
- - Messaging (Osiris)
291
- - Events (Osiris)
292
- - Leaderboards (Osiris/Olympus)
293
- - Game objects (Iris)
294
- - Asset metadata (Iris)
295
- - Alias lookup (Janus)
296
-
297
- ### Installation
298
- ```bash
299
- pip install mc5-api-client
300
- ```
301
-
302
- ### Development Installation
303
- ```bash
304
- pip install mc5-api-client[dev]
305
- ```
306
-
307
- ### Example Usage
308
- ```python
309
- from mc5_api_client import MC5Client
310
-
311
- with MC5Client(username="user", password="pass") as client:
312
- profile = client.get_profile()
313
- events = client.get_events()
314
- client.send_private_message("target", "Hello!")
315
- ```
316
-
317
- ### CLI Usage
318
- ```bash
319
- mc5 generate-token --username "user" --password "pass" --save
320
- mc5 validate-token
321
- mc5 show-config
322
- ```
323
-
324
- ---
325
-
326
- ## [Unreleased]
327
-
328
- ### Planned
329
- - Additional API endpoints
330
- - Enhanced CLI features
331
- - Performance optimizations
332
- - More examples and tutorials
@@ -1,16 +0,0 @@
1
- [tool:pytest]
2
- testpaths = tests
3
- python_files = test_*.py
4
- python_classes = Test*
5
- python_functions = test_*
6
- addopts =
7
- --verbose
8
- --tb=short
9
- --strict-markers
10
- --disable-warnings
11
- --color=yes
12
- markers =
13
- slow: marks tests as slow (deselect with '-m "not slow"')
14
- integration: marks tests as integration tests
15
- unit: marks tests as unit tests
16
- network: marks tests that require network access
@@ -1,25 +0,0 @@
1
- # Development dependencies
2
- -r requirements.txt
3
-
4
- # Testing
5
- pytest>=7.0.0
6
- pytest-cov>=4.0.0
7
- pytest-mock>=3.10.0
8
-
9
- # Code quality
10
- black>=22.0.0
11
- isort>=5.10.0
12
- mypy>=1.0.0
13
- flake8>=5.0.0
14
-
15
- # Pre-commit hooks
16
- pre-commit>=2.20.0
17
-
18
- # Building and distribution
19
- build>=0.8.0
20
- twine>=4.0.0
21
-
22
- # Documentation
23
- sphinx>=5.0.0
24
- sphinx-rtd-theme>=1.2.0
25
- myst-parser>=0.18.0
File without changes