mc5-api-client 1.0.19__tar.gz → 1.0.21__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.
- {mc5_api_client-1.0.19/src/mc5_api_client.egg-info → mc5_api_client-1.0.21}/PKG-INFO +102 -6
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/README.md +101 -5
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/pyproject.toml +1 -1
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/setup.py +1 -1
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/__init__.py +39 -4
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/client.py +180 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21/src/mc5_api_client.egg-info}/PKG-INFO +102 -6
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/.gitignore +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/LICENSE +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/MANIFEST.in +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/admin_squad_management.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/admin_tools.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/advanced_automation.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/advanced_features.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/authentication_example.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/basic_usage.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/clan_management.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/clan_management_complete.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/device_id_example.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/events_and_tasks.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/everyday_mc5.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/everyday_mc5_easy.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/game_launch_example.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/help_system.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/message_management.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/player_stats.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/private_messaging.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/quick_help.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/quick_reference.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/service_location_example.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/simple_usage.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/squad_management.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/examples/squad_wall_management.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/requirements.txt +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/setup.cfg +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/account.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/account_quick.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/admin_client.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/alerts.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/alerts_quick.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/auth.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/cli.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/debug.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/easy_mc5.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/exceptions.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/federation.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/federation_quick.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/help.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/pc_storage_client.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/pc_storage_quick.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/platform.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/py.typed +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/simple_client.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/squad_battle.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/squad_battle_quick.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/storage_admin.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/telemetry.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/transfer.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client/transfer_quick.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client.egg-info/SOURCES.txt +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client.egg-info/dependency_links.txt +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client.egg-info/entry_points.txt +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client.egg-info/not-zip-safe +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client.egg-info/requires.txt +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client.egg-info/top_level.txt +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/tests/__init__.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/tests/test_auth.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/tests/test_cli.py +0 -0
- {mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/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.
|
|
3
|
+
Version: 1.0.21
|
|
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.
|
|
146
|
+
pip install mc5_api_client==1.0.20
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
|
|
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.
|
|
68
|
+
pip install mc5_api_client==1.0.20
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
|
|
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.
|
|
7
|
+
version = "1.0.21"
|
|
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.
|
|
36
|
+
version="1.0.21",
|
|
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
|
+
__version__ = "1.0.21"
|
|
19
19
|
__author__ = "Chizoba"
|
|
20
20
|
__email__ = "chizoba2026@hotmail.com"
|
|
21
21
|
__license__ = "MIT"
|
|
@@ -88,6 +88,37 @@ from .auth import TokenGenerator
|
|
|
88
88
|
from .exceptions import MC5APIError, AuthenticationError, RateLimitError
|
|
89
89
|
from .help import help, examples, quick_reference
|
|
90
90
|
|
|
91
|
+
# Automatic Squad Management (NEW!)
|
|
92
|
+
from .client import MC5Client
|
|
93
|
+
|
|
94
|
+
# Add automatic squad management methods as standalone functions
|
|
95
|
+
def get_my_squad_id(client=None, **kwargs):
|
|
96
|
+
"""Get user's squad ID automatically."""
|
|
97
|
+
if client is None:
|
|
98
|
+
client = MC5Client(**kwargs)
|
|
99
|
+
return client.get_my_squad_id()
|
|
100
|
+
|
|
101
|
+
def get_my_squad_info(client=None, **kwargs):
|
|
102
|
+
"""Get user's squad information automatically."""
|
|
103
|
+
if client is None:
|
|
104
|
+
client = MC5Client(**kwargs)
|
|
105
|
+
return client.get_my_squad_info()
|
|
106
|
+
|
|
107
|
+
def update_my_squad_info(client=None, **squad_kwargs):
|
|
108
|
+
"""Update user's squad information automatically."""
|
|
109
|
+
client_kwargs = {k: v for k, v in squad_kwargs.items() if k in ['username', 'password', 'client_id']}
|
|
110
|
+
update_kwargs = {k: v for k, v in squad_kwargs.items() if k not in ['username', 'password', 'client_id']}
|
|
111
|
+
|
|
112
|
+
if client is None:
|
|
113
|
+
client = MC5Client(**client_kwargs)
|
|
114
|
+
return client.update_my_squad_info(**update_kwargs)
|
|
115
|
+
|
|
116
|
+
def get_my_squad_members(client=None, **kwargs):
|
|
117
|
+
"""Get user's squad members automatically."""
|
|
118
|
+
if client is None:
|
|
119
|
+
client = MC5Client(**kwargs)
|
|
120
|
+
return client.get_my_squad_members()
|
|
121
|
+
|
|
91
122
|
# Add MC5ApiClient as an alias for backward compatibility
|
|
92
123
|
MC5ApiClient = MC5Client
|
|
93
124
|
from .admin_client import (
|
|
@@ -399,9 +430,13 @@ __all__ = [
|
|
|
399
430
|
"MC5Easy",
|
|
400
431
|
"quick_connect",
|
|
401
432
|
"check_my_daily_tasks",
|
|
402
|
-
"
|
|
403
|
-
"
|
|
404
|
-
"
|
|
433
|
+
"get_server_status",
|
|
434
|
+
"get_online_players",
|
|
435
|
+
"get_server_info",
|
|
436
|
+
"get_my_squad_id",
|
|
437
|
+
"get_my_squad_info",
|
|
438
|
+
"update_my_squad_info",
|
|
439
|
+
"get_my_squad_members",
|
|
405
440
|
"generate_device_id",
|
|
406
441
|
"create_federation_session",
|
|
407
442
|
"locate_service",
|
|
@@ -1652,6 +1652,186 @@ class MC5Client(SquadBattleMixin, FederationMixin, AlertsMixin, AccountMixin, Tr
|
|
|
1652
1652
|
"timestamp": time.time()
|
|
1653
1653
|
}
|
|
1654
1654
|
|
|
1655
|
+
# Automatic Squad Management (NEW!)
|
|
1656
|
+
|
|
1657
|
+
def get_my_squad_id(self) -> Optional[str]:
|
|
1658
|
+
"""
|
|
1659
|
+
Automatically fetch the user's squad ID from their profile.
|
|
1660
|
+
|
|
1661
|
+
This method eliminates the need to manually specify squad ID for squad operations.
|
|
1662
|
+
It fetches the user's profile and extracts the squad/group ID from their groups.
|
|
1663
|
+
|
|
1664
|
+
Returns:
|
|
1665
|
+
Squad ID if found, None otherwise
|
|
1666
|
+
"""
|
|
1667
|
+
try:
|
|
1668
|
+
# Get user profile which contains groups information
|
|
1669
|
+
profile = self.get_profile()
|
|
1670
|
+
|
|
1671
|
+
if not profile:
|
|
1672
|
+
return None
|
|
1673
|
+
|
|
1674
|
+
# Check if user has groups
|
|
1675
|
+
groups = profile.get('groups', [])
|
|
1676
|
+
if not groups:
|
|
1677
|
+
return None
|
|
1678
|
+
|
|
1679
|
+
# Extract squad ID from groups (usually the first group is the squad)
|
|
1680
|
+
# Groups can be in different formats, handle multiple cases
|
|
1681
|
+
for group in groups:
|
|
1682
|
+
if isinstance(group, str):
|
|
1683
|
+
# Simple string ID
|
|
1684
|
+
return group
|
|
1685
|
+
elif isinstance(group, dict):
|
|
1686
|
+
# Dictionary with ID field
|
|
1687
|
+
if 'id' in group:
|
|
1688
|
+
return group['id']
|
|
1689
|
+
elif '_id' in group:
|
|
1690
|
+
return group['_id']
|
|
1691
|
+
elif 'group_id' in group:
|
|
1692
|
+
return group['group_id']
|
|
1693
|
+
|
|
1694
|
+
# If no group found in the expected format, try to extract from the groups string
|
|
1695
|
+
if groups and isinstance(groups[0], str):
|
|
1696
|
+
return groups[0]
|
|
1697
|
+
|
|
1698
|
+
return None
|
|
1699
|
+
|
|
1700
|
+
except Exception as e:
|
|
1701
|
+
print(f"🔴 Error fetching squad ID: {e}")
|
|
1702
|
+
return None
|
|
1703
|
+
|
|
1704
|
+
def get_my_squad_info(self) -> Dict[str, Any]:
|
|
1705
|
+
"""
|
|
1706
|
+
Get complete squad information using automatically fetched squad ID.
|
|
1707
|
+
|
|
1708
|
+
Returns:
|
|
1709
|
+
Dictionary with squad information or error details
|
|
1710
|
+
"""
|
|
1711
|
+
try:
|
|
1712
|
+
squad_id = self.get_my_squad_id()
|
|
1713
|
+
if not squad_id:
|
|
1714
|
+
return {
|
|
1715
|
+
"error": "No squad found for this user",
|
|
1716
|
+
"message": "User is not in any squad",
|
|
1717
|
+
"timestamp": time.time()
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
# Get squad information using the fetched ID
|
|
1721
|
+
squad_info = self.get_clan_settings(squad_id)
|
|
1722
|
+
|
|
1723
|
+
if squad_info:
|
|
1724
|
+
squad_info['auto_fetched_squad_id'] = squad_id
|
|
1725
|
+
squad_info['fetch_method'] = 'automatic'
|
|
1726
|
+
return squad_info
|
|
1727
|
+
else:
|
|
1728
|
+
return {
|
|
1729
|
+
"error": "Failed to fetch squad details",
|
|
1730
|
+
"squad_id": squad_id,
|
|
1731
|
+
"message": "Squad ID found but could not fetch details",
|
|
1732
|
+
"timestamp": time.time()
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
except Exception as e:
|
|
1736
|
+
return {
|
|
1737
|
+
"error": str(e),
|
|
1738
|
+
"message": "Failed to get squad information",
|
|
1739
|
+
"timestamp": time.time()
|
|
1740
|
+
}
|
|
1741
|
+
|
|
1742
|
+
def update_my_squad_info(self, **kwargs) -> Dict[str, Any]:
|
|
1743
|
+
"""
|
|
1744
|
+
Update squad information using automatically fetched squad ID.
|
|
1745
|
+
|
|
1746
|
+
This is a convenience method that combines get_my_squad_id() and update_clan_settings().
|
|
1747
|
+
Users don't need to specify squad ID - it's automatically fetched from their profile.
|
|
1748
|
+
|
|
1749
|
+
Args:
|
|
1750
|
+
**kwargs: Squad settings to update (same as update_clan_settings)
|
|
1751
|
+
- name: Squad name
|
|
1752
|
+
- description: Squad description
|
|
1753
|
+
- rating: Squad rating
|
|
1754
|
+
- min_join_value: Minimum join value
|
|
1755
|
+
- logo: Squad logo ID
|
|
1756
|
+
- logo_clr_prim: Primary logo color
|
|
1757
|
+
- logo_clr_sec: Secondary logo color
|
|
1758
|
+
|
|
1759
|
+
Returns:
|
|
1760
|
+
Dictionary with update result or error details
|
|
1761
|
+
"""
|
|
1762
|
+
try:
|
|
1763
|
+
squad_id = self.get_my_squad_id()
|
|
1764
|
+
if not squad_id:
|
|
1765
|
+
return {
|
|
1766
|
+
"error": "No squad found for this user",
|
|
1767
|
+
"message": "Cannot update squad - user is not in any squad",
|
|
1768
|
+
"timestamp": time.time()
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
# Update squad using the fetched ID
|
|
1772
|
+
result = self.update_clan_settings(squad_id, **kwargs)
|
|
1773
|
+
|
|
1774
|
+
if result:
|
|
1775
|
+
result['auto_fetched_squad_id'] = squad_id
|
|
1776
|
+
result['update_method'] = 'automatic'
|
|
1777
|
+
return result
|
|
1778
|
+
else:
|
|
1779
|
+
return {
|
|
1780
|
+
"error": "Failed to update squad",
|
|
1781
|
+
"squad_id": squad_id,
|
|
1782
|
+
"message": "Squad ID found but update failed",
|
|
1783
|
+
"timestamp": time.time()
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
except Exception as e:
|
|
1787
|
+
return {
|
|
1788
|
+
"error": str(e),
|
|
1789
|
+
"message": "Failed to update squad information",
|
|
1790
|
+
"timestamp": time.time()
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
def get_my_squad_members(self) -> Dict[str, Any]:
|
|
1794
|
+
"""
|
|
1795
|
+
Get squad members using automatically fetched squad ID.
|
|
1796
|
+
|
|
1797
|
+
Returns:
|
|
1798
|
+
Dictionary with squad members or error details
|
|
1799
|
+
"""
|
|
1800
|
+
try:
|
|
1801
|
+
squad_id = self.get_my_squad_id()
|
|
1802
|
+
if not squad_id:
|
|
1803
|
+
return {
|
|
1804
|
+
"error": "No squad found for this user",
|
|
1805
|
+
"message": "Cannot get squad members - user is not in any squad",
|
|
1806
|
+
"timestamp": time.time()
|
|
1807
|
+
}
|
|
1808
|
+
|
|
1809
|
+
# Get squad members using the fetched ID
|
|
1810
|
+
members = self.get_clan_members(squad_id)
|
|
1811
|
+
|
|
1812
|
+
if members:
|
|
1813
|
+
return {
|
|
1814
|
+
"squad_id": squad_id,
|
|
1815
|
+
"members": members,
|
|
1816
|
+
"member_count": len(members) if isinstance(members, list) else 0,
|
|
1817
|
+
"fetch_method": "automatic",
|
|
1818
|
+
"timestamp": time.time()
|
|
1819
|
+
}
|
|
1820
|
+
else:
|
|
1821
|
+
return {
|
|
1822
|
+
"error": "Failed to fetch squad members",
|
|
1823
|
+
"squad_id": squad_id,
|
|
1824
|
+
"message": "Squad ID found but could not fetch members",
|
|
1825
|
+
"timestamp": time.time()
|
|
1826
|
+
}
|
|
1827
|
+
|
|
1828
|
+
except Exception as e:
|
|
1829
|
+
return {
|
|
1830
|
+
"error": str(e),
|
|
1831
|
+
"message": "Failed to get squad members",
|
|
1832
|
+
"timestamp": time.time()
|
|
1833
|
+
}
|
|
1834
|
+
|
|
1655
1835
|
# Events API
|
|
1656
1836
|
|
|
1657
1837
|
def get_events(self, event_type: str = None, status: str = None) -> List[Dict[str, Any]]:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mc5_api_client
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.21
|
|
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.
|
|
146
|
+
pip install mc5_api_client==1.0.20
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
|
|
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
|
|
|
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
|
{mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{mc5_api_client-1.0.19 → mc5_api_client-1.0.21}/src/mc5_api_client.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|