mc5-api-client 1.0.17__tar.gz → 1.0.18__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.17 → mc5_api_client-1.0.18}/PKG-INFO +165 -20
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/README.md +164 -19
- mc5_api_client-1.0.18/examples/authentication_example.py +195 -0
- mc5_api_client-1.0.18/examples/device_id_example.py +199 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/examples/everyday_mc5.py +3 -3
- mc5_api_client-1.0.18/examples/everyday_mc5_easy.py +186 -0
- mc5_api_client-1.0.18/examples/game_launch_example.py +271 -0
- mc5_api_client-1.0.18/examples/service_location_example.py +281 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/pyproject.toml +1 -1
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/setup.py +1 -1
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/__init__.py +191 -7
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/client.py +24 -1
- mc5_api_client-1.0.18/src/mc5_api_client/easy_mc5.py +682 -0
- mc5_api_client-1.0.18/src/mc5_api_client/pc_storage_client.py +229 -0
- mc5_api_client-1.0.18/src/mc5_api_client/pc_storage_quick.py +234 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/platform.py +3 -4
- mc5_api_client-1.0.18/src/mc5_api_client/storage_admin.py +285 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client.egg-info/PKG-INFO +165 -20
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client.egg-info/SOURCES.txt +9 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/.gitignore +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/CHANGELOG.md +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/LICENSE +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/MANIFEST.in +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/examples/admin_squad_management.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/examples/admin_tools.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/examples/advanced_automation.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/examples/advanced_features.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/examples/basic_usage.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/examples/clan_management.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/examples/clan_management_complete.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/examples/events_and_tasks.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/examples/help_system.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/examples/message_management.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/examples/player_stats.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/examples/private_messaging.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/examples/quick_help.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/examples/quick_reference.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/examples/simple_usage.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/examples/squad_management.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/examples/squad_wall_management.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/pytest.ini +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/requirements-dev.txt +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/requirements.txt +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/setup.cfg +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/account.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/account_quick.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/admin_client.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/alerts.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/alerts_quick.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/auth.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/cli.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/debug.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/exceptions.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/federation.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/federation_quick.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/help.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/py.typed +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/simple_client.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/squad_battle.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/squad_battle_quick.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/telemetry.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/transfer.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client/transfer_quick.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client.egg-info/dependency_links.txt +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client.egg-info/entry_points.txt +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client.egg-info/not-zip-safe +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client.egg-info/requires.txt +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/src/mc5_api_client.egg-info/top_level.txt +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/tests/__init__.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/tests/test_auth.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/tests/test_cli.py +0 -0
- {mc5_api_client-1.0.17 → mc5_api_client-1.0.18}/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.18
|
|
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
|
|
@@ -81,23 +81,32 @@ Dynamic: requires-python
|
|
|
81
81
|
[](https://python.org)
|
|
82
82
|
[](LICENSE)
|
|
83
83
|
[](mailto:chizoba2026@hotmail.com)
|
|
84
|
-
[](https://pypi.org/project/mc5-api-client/)
|
|
85
85
|
[](https://pypi.org/project/mc5-api-client/)
|
|
86
86
|
|
|
87
87
|
Hey there! 👋 Welcome to the **Modern Combat 5 API Client** - Comprehensive Python library for interacting with Modern Combat 5 game servers
|
|
88
88
|
|
|
89
|
-
## ✨ **New in v1.0.
|
|
90
|
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
89
|
+
## ✨ **New in v1.0.18: Super Easy Interface & Complete Game Management!**
|
|
90
|
+
|
|
91
|
+
- 🎯 **NEW: MC5Easy** - Super simple one-line functions for everyday tasks
|
|
92
|
+
- 🚀 **NEW: One-Liner Functions** - `check_my_daily_tasks()`, `get_my_mc5_profile()`, `find_mc5_player()`
|
|
93
|
+
- 📝 **NEW: Context Manager** - Auto-connect and auto-cleanup with `with MC5Easy()`
|
|
94
|
+
- 🔧 **NEW: Environment Variables** - Secure credential management with `MC5_USERNAME` and `MC5_PASSWORD`
|
|
95
|
+
- 🌐 **NEW: Service Location** - Dynamic MC5 service endpoint discovery
|
|
96
|
+
- 🎮 **NEW: Federation Sessions** - Complete game launch preparation
|
|
97
|
+
- 🌍 **NEW: Global ID Management** - Device tracking and identification
|
|
98
|
+
- 🔗 **NEW: Connection Monitoring** - Service health and status tracking
|
|
99
|
+
- 🏠 **NEW: Room Discovery** - Find available game rooms
|
|
100
|
+
- 🏰 **PC Storage Admin** - Complete squad management with storage scopes
|
|
101
|
+
- 🔧 **StorageAdminMixin** - Core storage functionality for advanced operations
|
|
102
|
+
- 👤 **System Account Access** - 5 working system accounts discovered
|
|
103
|
+
- 🎯 **Owner Identification** - Complete squad ownership analysis
|
|
104
|
+
- 📊 **Squad Management** - Full CRUD operations for squad data
|
|
105
|
+
- 🛡️ **Security Enhanced** - All credentials sanitized and production ready
|
|
106
|
+
- 📁 **Clean Structure** - Organized file structure for production deployment
|
|
107
|
+
- 🚀 **Performance Optimized** - Removed debug files and optimized for production
|
|
108
|
+
- 📚 **Better Documentation** - Reorganized docs in proper structure
|
|
109
|
+
- 🔒 **Credential Security** - Complete security cleanup implemented
|
|
101
110
|
|
|
102
111
|
## 🌟 What Can You Do With This?
|
|
103
112
|
|
|
@@ -131,13 +140,149 @@ Think of this as your remote control for Modern Combat 5! Here's what you can do
|
|
|
131
140
|
|
|
132
141
|
## 🚀 Installation
|
|
133
142
|
|
|
134
|
-
### 🎉 MC5 API Client v1.0.
|
|
143
|
+
### 🎉 MC5 API Client v1.0.18 - Super Easy Interface & Clean API!
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
pip install mc5_api_client==1.0.18
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### ✅ **Major Features Completed!**
|
|
150
|
+
|
|
151
|
+
**🎯 Super Easy Interface (NEW in v1.0.18):**
|
|
152
|
+
- ✅ **MC5Easy Module** - One-line functions for everyday tasks
|
|
153
|
+
- ✅ **Context Manager** - Auto-connect and auto-cleanup with `with MC5Easy()`
|
|
154
|
+
- ✅ **Environment Variables** - Secure credential management
|
|
155
|
+
- ✅ **One-Liner Functions** - `check_my_daily_tasks()`, `get_my_mc5_profile()`, `find_mc5_player()`
|
|
156
|
+
- ✅ **Clean Function Names** - Removed ugly "quick_" prefixes
|
|
157
|
+
- ✅ **Authentication Examples** - Complete authentication guide
|
|
158
|
+
|
|
159
|
+
**🏰 PC Storage Admin (NEW in v1.0.18):**
|
|
160
|
+
- ✅ **PC Storage Admin** - Complete squad management with storage scopes
|
|
161
|
+
- ✅ **StorageAdminMixin** - Core storage functionality for advanced operations
|
|
162
|
+
- ✅ **System Account Access** - 5 working system accounts discovered
|
|
163
|
+
- ✅ **Owner Identification** - Complete squad ownership analysis
|
|
164
|
+
- ✅ **Squad Management** - Full CRUD operations for squad data
|
|
165
|
+
|
|
166
|
+
**🛡️ Production Ready (NEW in v1.0.18):**
|
|
167
|
+
- ✅ **Security Enhanced** - All credentials sanitized and production ready
|
|
168
|
+
- ✅ **Clean Structure** - Organized file structure for production deployment
|
|
169
|
+
- ✅ **Performance Optimized** - Removed debug files and optimized for production
|
|
170
|
+
- ✅ **Better Documentation** - Reorganized docs in proper structure
|
|
171
|
+
- ✅ **Credential Security** - Complete security cleanup implemented
|
|
172
|
+
|
|
173
|
+
## 🎯 **Super Easy Usage - NEW!**
|
|
174
|
+
|
|
175
|
+
### **🚀 One-Line Functions for Everyday Tasks**
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
from mc5_api_client import MC5Easy, check_my_daily_tasks, get_my_mc5_profile
|
|
179
|
+
|
|
180
|
+
# Method 1: Super simple one-liners (with environment variables)
|
|
181
|
+
tasks = check_my_daily_tasks() # Returns your daily tasks
|
|
182
|
+
profile = get_my_mc5_profile() # Returns your profile stats
|
|
183
|
+
player = find_mc5_player("f55f") # Find any player
|
|
184
|
+
send_mc5_message("f55f", "Hello!") # Send message
|
|
185
|
+
|
|
186
|
+
# Method 2: Easy context manager (auto-connect & cleanup)
|
|
187
|
+
with MC5Easy() as mc5:
|
|
188
|
+
tasks = mc5.check_daily_tasks()
|
|
189
|
+
profile = mc5.get_my_stats()
|
|
190
|
+
player = mc5.find_player("f55f")
|
|
191
|
+
mc5.send_message_to_friend("f55f", "Hello!")
|
|
192
|
+
mc5.broadcast_to_clan("Hello clan!")
|
|
193
|
+
|
|
194
|
+
# Method 3: Environment variables (recommended)
|
|
195
|
+
# Set these once:
|
|
196
|
+
export MC5_USERNAME="your_credential"
|
|
197
|
+
export MC5_PASSWORD="your_password"
|
|
198
|
+
|
|
199
|
+
# Then use any function without credentials:
|
|
200
|
+
with MC5Easy() as mc5: # Auto-uses environment variables
|
|
201
|
+
print(mc5.quick_status()) # Quick status overview
|
|
202
|
+
mc5.run_daily_routine() # Complete daily routine
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### **🔧 Set Up Environment Variables (Recommended)**
|
|
135
206
|
|
|
136
207
|
```bash
|
|
137
|
-
|
|
208
|
+
# Windows (Command Prompt)
|
|
209
|
+
set MC5_USERNAME=anonymous:your_credential_here
|
|
210
|
+
set MC5_PASSWORD=your_password_here
|
|
211
|
+
|
|
212
|
+
# Windows (PowerShell)
|
|
213
|
+
$env:MC5_USERNAME="anonymous:your_credential_here"
|
|
214
|
+
$env:MC5_PASSWORD="your_password_here"
|
|
215
|
+
|
|
216
|
+
# Linux/Mac
|
|
217
|
+
export MC5_USERNAME="anonymous:your_credential_here"
|
|
218
|
+
export MC5_PASSWORD="your_password_here"
|
|
138
219
|
```
|
|
139
220
|
|
|
140
|
-
###
|
|
221
|
+
### **📱 Run Examples:**
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
# Set your environment variables first, then:
|
|
225
|
+
python examples/everyday_mc5_easy.py
|
|
226
|
+
|
|
227
|
+
# Service location and game launch:
|
|
228
|
+
python examples/service_location_example.py
|
|
229
|
+
|
|
230
|
+
# Game launch and federation sessions:
|
|
231
|
+
python examples/game_launch_example.py
|
|
232
|
+
|
|
233
|
+
# Device ID management:
|
|
234
|
+
python examples/device_id_example.py
|
|
235
|
+
|
|
236
|
+
# Authentication examples:
|
|
237
|
+
python examples/authentication_example.py
|
|
238
|
+
|
|
239
|
+
# Basic usage:
|
|
240
|
+
python examples/basic_usage.py
|
|
241
|
+
|
|
242
|
+
# Or see one-liner demos:
|
|
243
|
+
python examples/everyday_mc5_easy.py --demo
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### **🌐 Service Location & Game Launch (NEW!)**
|
|
247
|
+
|
|
248
|
+
```python
|
|
249
|
+
from mc5_api_client import locate_service, get_all_services, create_federation_session
|
|
250
|
+
|
|
251
|
+
# Get all MC5 services dynamically
|
|
252
|
+
services = get_all_services()
|
|
253
|
+
print(f"Found {len(services)} services:")
|
|
254
|
+
for service, endpoint in services.items():
|
|
255
|
+
print(f" {service}: {endpoint}")
|
|
256
|
+
|
|
257
|
+
# Find specific service
|
|
258
|
+
auth_endpoint = locate_service("auth")
|
|
259
|
+
print(f"Auth service: {auth_endpoint}")
|
|
260
|
+
|
|
261
|
+
# Create federation session for game launch
|
|
262
|
+
session = create_federation_session(username, password)
|
|
263
|
+
if session.get("success"):
|
|
264
|
+
print(f"Room ID: {session['room_id']}")
|
|
265
|
+
print(f"Controller: {session['controller_host']}")
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### **🌐 Global ID & Device Management (NEW!)**
|
|
269
|
+
|
|
270
|
+
```python
|
|
271
|
+
from mc5_api_client import get_global_id, generate_device_id
|
|
272
|
+
|
|
273
|
+
# Get global device ID
|
|
274
|
+
global_id = get_global_id()
|
|
275
|
+
print(f"Global ID: {global_id}")
|
|
276
|
+
|
|
277
|
+
# Generate unique device ID
|
|
278
|
+
device_id = generate_device_id()
|
|
279
|
+
print(f"Device ID: {device_id}")
|
|
280
|
+
|
|
281
|
+
# With MC5Easy
|
|
282
|
+
with MC5Easy() as mc5:
|
|
283
|
+
device_info = mc5.get_device_info()
|
|
284
|
+
print(f"Device: {device_info}")
|
|
285
|
+
```
|
|
141
286
|
|
|
142
287
|
**� Android Squad Management (NEW in v1.0.17):**
|
|
143
288
|
- ✅ **Squad Information Retrieval**: Get current squad info, rating, and settings
|
|
@@ -1153,10 +1298,10 @@ for event in events:
|
|
|
1153
1298
|
For users who prefer additional security, the module now supports token encryption:
|
|
1154
1299
|
|
|
1155
1300
|
```python
|
|
1156
|
-
from mc5_api_client import
|
|
1301
|
+
from mc5_api_client import generate_encrypted_token, encrypt_token
|
|
1157
1302
|
|
|
1158
1303
|
# Generate and encrypt a token in one step
|
|
1159
|
-
encrypted_data =
|
|
1304
|
+
encrypted_data = generate_encrypted_token(
|
|
1160
1305
|
username="anonymous:d2luOF92M18xNzcwMDUxNjkwXy7H33aeTVB4YZictyDq48c=",
|
|
1161
1306
|
password="sSJKzhQ5l4vrFgov",
|
|
1162
1307
|
nonce="*" # Custom nonce value (optional)
|
|
@@ -1168,7 +1313,7 @@ print(f"Expires: {encrypted_data['expires_at']}")
|
|
|
1168
1313
|
|
|
1169
1314
|
# Encrypt an existing token
|
|
1170
1315
|
existing_token = "your_raw_access_token_here"
|
|
1171
|
-
encrypted_token =
|
|
1316
|
+
encrypted_token = encrypt_token(existing_token, "*")
|
|
1172
1317
|
print(f"Encrypted: {encrypted_token}")
|
|
1173
1318
|
```
|
|
1174
1319
|
|
|
@@ -3,23 +3,32 @@
|
|
|
3
3
|
[](https://python.org)
|
|
4
4
|
[](LICENSE)
|
|
5
5
|
[](mailto:chizoba2026@hotmail.com)
|
|
6
|
-
[](https://pypi.org/project/mc5-api-client/)
|
|
7
7
|
[](https://pypi.org/project/mc5-api-client/)
|
|
8
8
|
|
|
9
9
|
Hey there! 👋 Welcome to the **Modern Combat 5 API Client** - Comprehensive Python library for interacting with Modern Combat 5 game servers
|
|
10
10
|
|
|
11
|
-
## ✨ **New in v1.0.
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
11
|
+
## ✨ **New in v1.0.18: Super Easy Interface & Complete Game Management!**
|
|
12
|
+
|
|
13
|
+
- 🎯 **NEW: MC5Easy** - Super simple one-line functions for everyday tasks
|
|
14
|
+
- 🚀 **NEW: One-Liner Functions** - `check_my_daily_tasks()`, `get_my_mc5_profile()`, `find_mc5_player()`
|
|
15
|
+
- 📝 **NEW: Context Manager** - Auto-connect and auto-cleanup with `with MC5Easy()`
|
|
16
|
+
- 🔧 **NEW: Environment Variables** - Secure credential management with `MC5_USERNAME` and `MC5_PASSWORD`
|
|
17
|
+
- 🌐 **NEW: Service Location** - Dynamic MC5 service endpoint discovery
|
|
18
|
+
- 🎮 **NEW: Federation Sessions** - Complete game launch preparation
|
|
19
|
+
- 🌍 **NEW: Global ID Management** - Device tracking and identification
|
|
20
|
+
- 🔗 **NEW: Connection Monitoring** - Service health and status tracking
|
|
21
|
+
- 🏠 **NEW: Room Discovery** - Find available game rooms
|
|
22
|
+
- 🏰 **PC Storage Admin** - Complete squad management with storage scopes
|
|
23
|
+
- 🔧 **StorageAdminMixin** - Core storage functionality for advanced operations
|
|
24
|
+
- 👤 **System Account Access** - 5 working system accounts discovered
|
|
25
|
+
- 🎯 **Owner Identification** - Complete squad ownership analysis
|
|
26
|
+
- 📊 **Squad Management** - Full CRUD operations for squad data
|
|
27
|
+
- 🛡️ **Security Enhanced** - All credentials sanitized and production ready
|
|
28
|
+
- 📁 **Clean Structure** - Organized file structure for production deployment
|
|
29
|
+
- 🚀 **Performance Optimized** - Removed debug files and optimized for production
|
|
30
|
+
- 📚 **Better Documentation** - Reorganized docs in proper structure
|
|
31
|
+
- 🔒 **Credential Security** - Complete security cleanup implemented
|
|
23
32
|
|
|
24
33
|
## 🌟 What Can You Do With This?
|
|
25
34
|
|
|
@@ -53,13 +62,149 @@ Think of this as your remote control for Modern Combat 5! Here's what you can do
|
|
|
53
62
|
|
|
54
63
|
## 🚀 Installation
|
|
55
64
|
|
|
56
|
-
### 🎉 MC5 API Client v1.0.
|
|
65
|
+
### 🎉 MC5 API Client v1.0.18 - Super Easy Interface & Clean API!
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
pip install mc5_api_client==1.0.18
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### ✅ **Major Features Completed!**
|
|
72
|
+
|
|
73
|
+
**🎯 Super Easy Interface (NEW in v1.0.18):**
|
|
74
|
+
- ✅ **MC5Easy Module** - One-line functions for everyday tasks
|
|
75
|
+
- ✅ **Context Manager** - Auto-connect and auto-cleanup with `with MC5Easy()`
|
|
76
|
+
- ✅ **Environment Variables** - Secure credential management
|
|
77
|
+
- ✅ **One-Liner Functions** - `check_my_daily_tasks()`, `get_my_mc5_profile()`, `find_mc5_player()`
|
|
78
|
+
- ✅ **Clean Function Names** - Removed ugly "quick_" prefixes
|
|
79
|
+
- ✅ **Authentication Examples** - Complete authentication guide
|
|
80
|
+
|
|
81
|
+
**🏰 PC Storage Admin (NEW in v1.0.18):**
|
|
82
|
+
- ✅ **PC Storage Admin** - Complete squad management with storage scopes
|
|
83
|
+
- ✅ **StorageAdminMixin** - Core storage functionality for advanced operations
|
|
84
|
+
- ✅ **System Account Access** - 5 working system accounts discovered
|
|
85
|
+
- ✅ **Owner Identification** - Complete squad ownership analysis
|
|
86
|
+
- ✅ **Squad Management** - Full CRUD operations for squad data
|
|
87
|
+
|
|
88
|
+
**🛡️ Production Ready (NEW in v1.0.18):**
|
|
89
|
+
- ✅ **Security Enhanced** - All credentials sanitized and production ready
|
|
90
|
+
- ✅ **Clean Structure** - Organized file structure for production deployment
|
|
91
|
+
- ✅ **Performance Optimized** - Removed debug files and optimized for production
|
|
92
|
+
- ✅ **Better Documentation** - Reorganized docs in proper structure
|
|
93
|
+
- ✅ **Credential Security** - Complete security cleanup implemented
|
|
94
|
+
|
|
95
|
+
## 🎯 **Super Easy Usage - NEW!**
|
|
96
|
+
|
|
97
|
+
### **🚀 One-Line Functions for Everyday Tasks**
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
from mc5_api_client import MC5Easy, check_my_daily_tasks, get_my_mc5_profile
|
|
101
|
+
|
|
102
|
+
# Method 1: Super simple one-liners (with environment variables)
|
|
103
|
+
tasks = check_my_daily_tasks() # Returns your daily tasks
|
|
104
|
+
profile = get_my_mc5_profile() # Returns your profile stats
|
|
105
|
+
player = find_mc5_player("f55f") # Find any player
|
|
106
|
+
send_mc5_message("f55f", "Hello!") # Send message
|
|
107
|
+
|
|
108
|
+
# Method 2: Easy context manager (auto-connect & cleanup)
|
|
109
|
+
with MC5Easy() as mc5:
|
|
110
|
+
tasks = mc5.check_daily_tasks()
|
|
111
|
+
profile = mc5.get_my_stats()
|
|
112
|
+
player = mc5.find_player("f55f")
|
|
113
|
+
mc5.send_message_to_friend("f55f", "Hello!")
|
|
114
|
+
mc5.broadcast_to_clan("Hello clan!")
|
|
115
|
+
|
|
116
|
+
# Method 3: Environment variables (recommended)
|
|
117
|
+
# Set these once:
|
|
118
|
+
export MC5_USERNAME="your_credential"
|
|
119
|
+
export MC5_PASSWORD="your_password"
|
|
120
|
+
|
|
121
|
+
# Then use any function without credentials:
|
|
122
|
+
with MC5Easy() as mc5: # Auto-uses environment variables
|
|
123
|
+
print(mc5.quick_status()) # Quick status overview
|
|
124
|
+
mc5.run_daily_routine() # Complete daily routine
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### **🔧 Set Up Environment Variables (Recommended)**
|
|
57
128
|
|
|
58
129
|
```bash
|
|
59
|
-
|
|
130
|
+
# Windows (Command Prompt)
|
|
131
|
+
set MC5_USERNAME=anonymous:your_credential_here
|
|
132
|
+
set MC5_PASSWORD=your_password_here
|
|
133
|
+
|
|
134
|
+
# Windows (PowerShell)
|
|
135
|
+
$env:MC5_USERNAME="anonymous:your_credential_here"
|
|
136
|
+
$env:MC5_PASSWORD="your_password_here"
|
|
137
|
+
|
|
138
|
+
# Linux/Mac
|
|
139
|
+
export MC5_USERNAME="anonymous:your_credential_here"
|
|
140
|
+
export MC5_PASSWORD="your_password_here"
|
|
60
141
|
```
|
|
61
142
|
|
|
62
|
-
###
|
|
143
|
+
### **📱 Run Examples:**
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Set your environment variables first, then:
|
|
147
|
+
python examples/everyday_mc5_easy.py
|
|
148
|
+
|
|
149
|
+
# Service location and game launch:
|
|
150
|
+
python examples/service_location_example.py
|
|
151
|
+
|
|
152
|
+
# Game launch and federation sessions:
|
|
153
|
+
python examples/game_launch_example.py
|
|
154
|
+
|
|
155
|
+
# Device ID management:
|
|
156
|
+
python examples/device_id_example.py
|
|
157
|
+
|
|
158
|
+
# Authentication examples:
|
|
159
|
+
python examples/authentication_example.py
|
|
160
|
+
|
|
161
|
+
# Basic usage:
|
|
162
|
+
python examples/basic_usage.py
|
|
163
|
+
|
|
164
|
+
# Or see one-liner demos:
|
|
165
|
+
python examples/everyday_mc5_easy.py --demo
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### **🌐 Service Location & Game Launch (NEW!)**
|
|
169
|
+
|
|
170
|
+
```python
|
|
171
|
+
from mc5_api_client import locate_service, get_all_services, create_federation_session
|
|
172
|
+
|
|
173
|
+
# Get all MC5 services dynamically
|
|
174
|
+
services = get_all_services()
|
|
175
|
+
print(f"Found {len(services)} services:")
|
|
176
|
+
for service, endpoint in services.items():
|
|
177
|
+
print(f" {service}: {endpoint}")
|
|
178
|
+
|
|
179
|
+
# Find specific service
|
|
180
|
+
auth_endpoint = locate_service("auth")
|
|
181
|
+
print(f"Auth service: {auth_endpoint}")
|
|
182
|
+
|
|
183
|
+
# Create federation session for game launch
|
|
184
|
+
session = create_federation_session(username, password)
|
|
185
|
+
if session.get("success"):
|
|
186
|
+
print(f"Room ID: {session['room_id']}")
|
|
187
|
+
print(f"Controller: {session['controller_host']}")
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### **🌐 Global ID & Device Management (NEW!)**
|
|
191
|
+
|
|
192
|
+
```python
|
|
193
|
+
from mc5_api_client import get_global_id, generate_device_id
|
|
194
|
+
|
|
195
|
+
# Get global device ID
|
|
196
|
+
global_id = get_global_id()
|
|
197
|
+
print(f"Global ID: {global_id}")
|
|
198
|
+
|
|
199
|
+
# Generate unique device ID
|
|
200
|
+
device_id = generate_device_id()
|
|
201
|
+
print(f"Device ID: {device_id}")
|
|
202
|
+
|
|
203
|
+
# With MC5Easy
|
|
204
|
+
with MC5Easy() as mc5:
|
|
205
|
+
device_info = mc5.get_device_info()
|
|
206
|
+
print(f"Device: {device_info}")
|
|
207
|
+
```
|
|
63
208
|
|
|
64
209
|
**� Android Squad Management (NEW in v1.0.17):**
|
|
65
210
|
- ✅ **Squad Information Retrieval**: Get current squad info, rating, and settings
|
|
@@ -1075,10 +1220,10 @@ for event in events:
|
|
|
1075
1220
|
For users who prefer additional security, the module now supports token encryption:
|
|
1076
1221
|
|
|
1077
1222
|
```python
|
|
1078
|
-
from mc5_api_client import
|
|
1223
|
+
from mc5_api_client import generate_encrypted_token, encrypt_token
|
|
1079
1224
|
|
|
1080
1225
|
# Generate and encrypt a token in one step
|
|
1081
|
-
encrypted_data =
|
|
1226
|
+
encrypted_data = generate_encrypted_token(
|
|
1082
1227
|
username="anonymous:d2luOF92M18xNzcwMDUxNjkwXy7H33aeTVB4YZictyDq48c=",
|
|
1083
1228
|
password="sSJKzhQ5l4vrFgov",
|
|
1084
1229
|
nonce="*" # Custom nonce value (optional)
|
|
@@ -1090,7 +1235,7 @@ print(f"Expires: {encrypted_data['expires_at']}")
|
|
|
1090
1235
|
|
|
1091
1236
|
# Encrypt an existing token
|
|
1092
1237
|
existing_token = "your_raw_access_token_here"
|
|
1093
|
-
encrypted_token =
|
|
1238
|
+
encrypted_token = encrypt_token(existing_token, "*")
|
|
1094
1239
|
print(f"Encrypted: {encrypted_token}")
|
|
1095
1240
|
```
|
|
1096
1241
|
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# ────────────[ CHIZOBA ]────────────────────────────
|
|
3
|
+
# | Email : chizoba2026@hotmail.com
|
|
4
|
+
# | File : authentication_example.py
|
|
5
|
+
# | License | MIT License © 2026 Chizoba
|
|
6
|
+
# | Brief | Example of MC5 authentication with proper scopes
|
|
7
|
+
# ────────────────★─────────────────────────────────
|
|
8
|
+
|
|
9
|
+
"""
|
|
10
|
+
MC5 Authentication Example
|
|
11
|
+
=======================
|
|
12
|
+
|
|
13
|
+
This example demonstrates how to authenticate with MC5 servers using different methods.
|
|
14
|
+
Shows proper token generation and usage with correct scopes.
|
|
15
|
+
|
|
16
|
+
Setup:
|
|
17
|
+
1. Replace YOUR_CREDENTIAL and YOUR_PASSWORD with your actual MC5 credentials
|
|
18
|
+
2. Or set environment variables:
|
|
19
|
+
export MC5_USERNAME="your_credential"
|
|
20
|
+
export MC5_PASSWORD="your_password"
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
import os
|
|
24
|
+
import sys
|
|
25
|
+
from mc5_api_client import MC5Client, TokenGenerator, generate_encrypted_token
|
|
26
|
+
|
|
27
|
+
def main():
|
|
28
|
+
"""Demonstrate MC5 authentication methods."""
|
|
29
|
+
print("🔐 MC5 Authentication Examples")
|
|
30
|
+
print("=" * 40)
|
|
31
|
+
|
|
32
|
+
# Method 1: Use environment variables (recommended)
|
|
33
|
+
username = os.getenv('MC5_USERNAME') or "YOUR_MC5_CREDENTIAL"
|
|
34
|
+
password = os.getenv('MC5_PASSWORD') or "YOUR_MC5_PASSWORD"
|
|
35
|
+
|
|
36
|
+
if username == "YOUR_MC5_CREDENTIAL" or password == "YOUR_MC5_PASSWORD":
|
|
37
|
+
print("⚠️ Please set your MC5 credentials:")
|
|
38
|
+
print(" Option 1: Set environment variables MC5_USERNAME and MC5_PASSWORD")
|
|
39
|
+
print(" Option 2: Edit the username and password variables in this script")
|
|
40
|
+
print()
|
|
41
|
+
print(" Example:")
|
|
42
|
+
print(" export MC5_USERNAME='anonymous:your_credential_here'")
|
|
43
|
+
print(" export MC5_PASSWORD='your_password_here'")
|
|
44
|
+
return
|
|
45
|
+
|
|
46
|
+
print(f"🔑 Using credentials: {username[:30]}...")
|
|
47
|
+
print()
|
|
48
|
+
|
|
49
|
+
# === Method 1: Using MC5Client ===
|
|
50
|
+
print("🎮 Method 1: Using MC5Client")
|
|
51
|
+
print("-" * 30)
|
|
52
|
+
|
|
53
|
+
try:
|
|
54
|
+
client = MC5Client(username=username, password=password)
|
|
55
|
+
client.authenticate()
|
|
56
|
+
|
|
57
|
+
print("✅ MC5Client authentication successful!")
|
|
58
|
+
print(f" Token: {client._token_data['access_token'][:30]}...")
|
|
59
|
+
print(f" Scopes: {client._token_data.get('scopes', [])}")
|
|
60
|
+
|
|
61
|
+
# Test getting profile (requires storage scope)
|
|
62
|
+
try:
|
|
63
|
+
profile = client.get_profile()
|
|
64
|
+
print("✅ Profile retrieved successfully!")
|
|
65
|
+
print(f" Name: {profile.get('name', 'Unknown')}")
|
|
66
|
+
print(f" Level: {profile.get('level', 'Unknown')}")
|
|
67
|
+
except Exception as e:
|
|
68
|
+
print(f"⚠️ Profile access: {e}")
|
|
69
|
+
print(" 💡 This might need additional scopes like 'storage'")
|
|
70
|
+
|
|
71
|
+
client.close()
|
|
72
|
+
|
|
73
|
+
except Exception as e:
|
|
74
|
+
print(f"❌ MC5Client authentication failed: {e}")
|
|
75
|
+
|
|
76
|
+
print()
|
|
77
|
+
|
|
78
|
+
# === Method 2: Using TokenGenerator directly ===
|
|
79
|
+
print("🔧 Method 2: Using TokenGenerator")
|
|
80
|
+
print("-" * 35)
|
|
81
|
+
|
|
82
|
+
try:
|
|
83
|
+
token_gen = TokenGenerator(client_id="1875:55979:6.0.0a:windows:windows")
|
|
84
|
+
|
|
85
|
+
# Try with basic scopes
|
|
86
|
+
basic_scopes = "alert auth chat leaderboard_ro lobby message session social"
|
|
87
|
+
token_data = token_gen.generate_token(
|
|
88
|
+
username=username,
|
|
89
|
+
password=password,
|
|
90
|
+
scope=basic_scopes
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
print("✅ TokenGenerator authentication successful!")
|
|
94
|
+
print(f" Token: {token_data['access_token'][:30]}...")
|
|
95
|
+
print(f" Scopes: {token_data.get('scopes', [])}")
|
|
96
|
+
|
|
97
|
+
token_gen.close()
|
|
98
|
+
|
|
99
|
+
except Exception as e:
|
|
100
|
+
print(f"❌ TokenGenerator authentication failed: {e}")
|
|
101
|
+
|
|
102
|
+
print()
|
|
103
|
+
|
|
104
|
+
# === Method 3: Generate encrypted token ===
|
|
105
|
+
print("🔒 Method 3: Generate Encrypted Token")
|
|
106
|
+
print("-" * 40)
|
|
107
|
+
|
|
108
|
+
try:
|
|
109
|
+
encrypted_data = generate_encrypted_token(
|
|
110
|
+
username=username,
|
|
111
|
+
password=password,
|
|
112
|
+
scope="alert auth chat social storage"
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
print("✅ Encrypted token generated successfully!")
|
|
116
|
+
print(f" Encrypted: {encrypted_data.get('encrypted_token', '')[:50]}...")
|
|
117
|
+
print(f" Nonce: {encrypted_data.get('nonce', '')}")
|
|
118
|
+
|
|
119
|
+
except Exception as e:
|
|
120
|
+
print(f"❌ Encrypted token generation failed: {e}")
|
|
121
|
+
|
|
122
|
+
print()
|
|
123
|
+
|
|
124
|
+
# === Method 4: Using MC5Easy (if available) ===
|
|
125
|
+
print("🎯 Method 4: Using MC5Easy (Super Simple)")
|
|
126
|
+
print("-" * 42)
|
|
127
|
+
|
|
128
|
+
try:
|
|
129
|
+
from mc5_api_client import MC5Easy
|
|
130
|
+
|
|
131
|
+
with MC5Easy(username, password) as mc5:
|
|
132
|
+
print("✅ MC5Easy authentication successful!")
|
|
133
|
+
|
|
134
|
+
# Quick status
|
|
135
|
+
status = mc5.quick_status()
|
|
136
|
+
print("📊 Quick Status:")
|
|
137
|
+
print(status)
|
|
138
|
+
|
|
139
|
+
except Exception as e:
|
|
140
|
+
print(f"❌ MC5Easy authentication failed: {e}")
|
|
141
|
+
|
|
142
|
+
print()
|
|
143
|
+
print("🎉 Authentication examples completed!")
|
|
144
|
+
print("💡 Tips:")
|
|
145
|
+
print(" - Use MC5Easy for everyday tasks")
|
|
146
|
+
print(" - Use TokenGenerator for advanced control")
|
|
147
|
+
print(" - Use MC5Client for full API access")
|
|
148
|
+
print(" - Add 'storage' scope for profile access")
|
|
149
|
+
|
|
150
|
+
def demo_scopes():
|
|
151
|
+
"""Demonstrate different scope combinations."""
|
|
152
|
+
print("\n🔍 Scope Examples")
|
|
153
|
+
print("=" * 20)
|
|
154
|
+
|
|
155
|
+
username = os.getenv('MC5_USERNAME')
|
|
156
|
+
password = os.getenv('MC5_PASSWORD')
|
|
157
|
+
|
|
158
|
+
if not username or not password:
|
|
159
|
+
print("⚠️ Set MC5_USERNAME and MC5_PASSWORD environment variables to test scopes")
|
|
160
|
+
return
|
|
161
|
+
|
|
162
|
+
scope_examples = [
|
|
163
|
+
("Basic", "alert auth chat social"),
|
|
164
|
+
("With Storage", "alert auth chat social storage"),
|
|
165
|
+
("With Leaderboard", "alert auth chat social storage leaderboard_ro"),
|
|
166
|
+
("Full Access", "alert auth chat social storage storage_restricted storage_admin leaderboard_ro lobby message session config tracking_bi feed storage leaderboard_admin social_eve social soc transaction schedule lottery voice matchmaker")
|
|
167
|
+
]
|
|
168
|
+
|
|
169
|
+
token_gen = TokenGenerator(client_id="1875:55979:6.0.0a:windows:windows")
|
|
170
|
+
|
|
171
|
+
try:
|
|
172
|
+
for name, scope in scope_examples:
|
|
173
|
+
print(f"\n🎯 {name} Scopes:")
|
|
174
|
+
print(f" Scope: {scope}")
|
|
175
|
+
|
|
176
|
+
try:
|
|
177
|
+
token_data = token_gen.generate_token(
|
|
178
|
+
username=username,
|
|
179
|
+
password=password,
|
|
180
|
+
scope=scope
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
print(f" ✅ Success! Scopes: {token_data.get('scopes', [])}")
|
|
184
|
+
|
|
185
|
+
except Exception as e:
|
|
186
|
+
print(f" ❌ Failed: {e}")
|
|
187
|
+
|
|
188
|
+
finally:
|
|
189
|
+
token_gen.close()
|
|
190
|
+
|
|
191
|
+
if __name__ == "__main__":
|
|
192
|
+
main()
|
|
193
|
+
|
|
194
|
+
# Uncomment to test different scopes
|
|
195
|
+
# demo_scopes()
|