mc5-api-client 1.0.17__py3-none-any.whl → 1.0.19__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mc5_api_client/__init__.py +195 -7
- mc5_api_client/client.py +92 -16
- mc5_api_client/easy_mc5.py +682 -0
- mc5_api_client/pc_storage_client.py +229 -0
- mc5_api_client/pc_storage_quick.py +234 -0
- mc5_api_client/platform.py +3 -4
- mc5_api_client/storage_admin.py +285 -0
- {mc5_api_client-1.0.17.dist-info → mc5_api_client-1.0.19.dist-info}/METADATA +165 -20
- {mc5_api_client-1.0.17.dist-info → mc5_api_client-1.0.19.dist-info}/RECORD +13 -9
- {mc5_api_client-1.0.17.dist-info → mc5_api_client-1.0.19.dist-info}/WHEEL +0 -0
- {mc5_api_client-1.0.17.dist-info → mc5_api_client-1.0.19.dist-info}/entry_points.txt +0 -0
- {mc5_api_client-1.0.17.dist-info → mc5_api_client-1.0.19.dist-info}/licenses/LICENSE +0 -0
- {mc5_api_client-1.0.17.dist-info → mc5_api_client-1.0.19.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
# ────────────[ CHIZOBA ]────────────────────────────
|
|
2
|
+
# | Email : chizoba2026@hotmail.com
|
|
3
|
+
# | File : storage_admin.py
|
|
4
|
+
# | License : MIT License © 2026 Chizoba
|
|
5
|
+
# | Brief | Storage admin mixin for MC5 API client
|
|
6
|
+
# ────────────────★─────────────────────────────────
|
|
7
|
+
|
|
8
|
+
"""
|
|
9
|
+
Storage admin mixin for MC5 API client with storage, storage_restricted, and storage_admin scopes.
|
|
10
|
+
Provides advanced squad management capabilities for PC platform.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import time
|
|
14
|
+
from typing import Optional, Dict, Any, List
|
|
15
|
+
from .exceptions import InsufficientScopeError
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class StorageAdminMixin:
|
|
19
|
+
"""
|
|
20
|
+
Mixin providing storage admin capabilities for MC5 API client.
|
|
21
|
+
|
|
22
|
+
This mixin requires storage, storage_restricted, or storage_admin scopes
|
|
23
|
+
and provides advanced squad management features including deletion
|
|
24
|
+
and comprehensive information modification.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
def __init__(self):
|
|
28
|
+
"""Initialize storage admin mixin."""
|
|
29
|
+
super().__init__()
|
|
30
|
+
self._storage_base_url = "https://eur-seshat.gameloft.com"
|
|
31
|
+
|
|
32
|
+
def _ensure_storage_scope(self, required_scope: str = "storage"):
|
|
33
|
+
"""Ensure the current token has the required storage scope."""
|
|
34
|
+
if not hasattr(self, '_token_data') or not self._token_data:
|
|
35
|
+
raise InsufficientScopeError(required_scope)
|
|
36
|
+
|
|
37
|
+
scopes = self._token_data.get('scopes', [])
|
|
38
|
+
if not any(scope in scopes for scope in [required_scope, 'storage_restricted', 'storage_admin']):
|
|
39
|
+
raise InsufficientScopeError(required_scope)
|
|
40
|
+
|
|
41
|
+
def delete_squad(
|
|
42
|
+
self,
|
|
43
|
+
squad_id: str
|
|
44
|
+
) -> Dict[str, Any]:
|
|
45
|
+
"""
|
|
46
|
+
Delete a squad (requires storage_admin scope).
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
squad_id: Squad ID to delete
|
|
50
|
+
|
|
51
|
+
Returns:
|
|
52
|
+
Deletion response
|
|
53
|
+
"""
|
|
54
|
+
self._ensure_storage_scope("storage_admin")
|
|
55
|
+
|
|
56
|
+
url = f"{self._storage_base_url}/groups/{squad_id}"
|
|
57
|
+
params = {
|
|
58
|
+
"access_token": self._token_data['access_token'],
|
|
59
|
+
"game": "mc5_system"
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return self._make_request("DELETE", url, params=params)
|
|
63
|
+
|
|
64
|
+
def get_squad_storage_info(
|
|
65
|
+
self,
|
|
66
|
+
squad_id: str
|
|
67
|
+
) -> Dict[str, Any]:
|
|
68
|
+
"""
|
|
69
|
+
Get comprehensive squad storage information.
|
|
70
|
+
|
|
71
|
+
Args:
|
|
72
|
+
squad_id: Squad ID to retrieve
|
|
73
|
+
|
|
74
|
+
Returns:
|
|
75
|
+
Squad storage information
|
|
76
|
+
"""
|
|
77
|
+
self._ensure_storage_scope("storage")
|
|
78
|
+
|
|
79
|
+
url = f"{self._storage_base_url}/groups/{squad_id}"
|
|
80
|
+
params = {
|
|
81
|
+
"access_token": self._token_data['access_token'],
|
|
82
|
+
"game": "mc5_system",
|
|
83
|
+
"include_fields": "all"
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return self._make_request("GET", url, params=params)
|
|
87
|
+
|
|
88
|
+
def update_squad_storage(
|
|
89
|
+
self,
|
|
90
|
+
squad_id: str,
|
|
91
|
+
name: Optional[str] = None,
|
|
92
|
+
description: Optional[str] = None,
|
|
93
|
+
rating: Optional[int] = None,
|
|
94
|
+
score: Optional[int] = None,
|
|
95
|
+
member_count: Optional[int] = None,
|
|
96
|
+
member_limit: Optional[int] = None,
|
|
97
|
+
membership: Optional[str] = None,
|
|
98
|
+
logo: Optional[str] = None,
|
|
99
|
+
logo_color_primary: Optional[int] = None,
|
|
100
|
+
logo_color_secondary: Optional[int] = None,
|
|
101
|
+
min_join_value: Optional[int] = None,
|
|
102
|
+
currency: Optional[int] = None,
|
|
103
|
+
active_clan_label: Optional[bool] = None,
|
|
104
|
+
privacy: Optional[str] = None,
|
|
105
|
+
tags: Optional[List[str]] = None
|
|
106
|
+
) -> Dict[str, Any]:
|
|
107
|
+
"""
|
|
108
|
+
Update squad storage information with admin capabilities.
|
|
109
|
+
|
|
110
|
+
Args:
|
|
111
|
+
squad_id: Squad ID to update
|
|
112
|
+
name: Squad name
|
|
113
|
+
description: Squad description
|
|
114
|
+
rating: Squad rating
|
|
115
|
+
score: Squad score
|
|
116
|
+
member_count: Current member count
|
|
117
|
+
member_limit: Maximum member limit
|
|
118
|
+
membership: Membership type
|
|
119
|
+
logo: Logo ID
|
|
120
|
+
logo_color_primary: Primary logo color
|
|
121
|
+
logo_color_secondary: Secondary logo color
|
|
122
|
+
min_join_value: Minimum join value
|
|
123
|
+
currency: Squad currency
|
|
124
|
+
active_clan_label: Whether clan label is active
|
|
125
|
+
privacy: Privacy settings
|
|
126
|
+
tags: Squad tags
|
|
127
|
+
|
|
128
|
+
Returns:
|
|
129
|
+
Update response
|
|
130
|
+
"""
|
|
131
|
+
self._ensure_storage_scope("storage")
|
|
132
|
+
|
|
133
|
+
url = f"{self._storage_base_url}/groups/{squad_id}"
|
|
134
|
+
|
|
135
|
+
# Build payload with provided parameters
|
|
136
|
+
payload = {
|
|
137
|
+
"access_token": self._token_data['access_token'],
|
|
138
|
+
"game": "mc5_system",
|
|
139
|
+
"timestamp": str(int(time.time())),
|
|
140
|
+
"_anonId": self._username if hasattr(self, '_username') else "game:mc5_system"
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
# Add optional parameters if provided
|
|
144
|
+
if name is not None:
|
|
145
|
+
payload["name"] = name
|
|
146
|
+
if description is not None:
|
|
147
|
+
payload["description"] = description
|
|
148
|
+
if rating is not None:
|
|
149
|
+
payload["_rating"] = str(rating)
|
|
150
|
+
if score is not None:
|
|
151
|
+
payload["score"] = str(score)
|
|
152
|
+
if member_count is not None:
|
|
153
|
+
payload["member_count"] = str(member_count)
|
|
154
|
+
if member_limit is not None:
|
|
155
|
+
payload["member_limit"] = str(member_limit)
|
|
156
|
+
if membership is not None:
|
|
157
|
+
payload["membership"] = membership
|
|
158
|
+
if logo is not None:
|
|
159
|
+
payload["_logo"] = logo
|
|
160
|
+
if logo_color_primary is not None:
|
|
161
|
+
payload["_logo_clr_prim"] = str(logo_color_primary)
|
|
162
|
+
if logo_color_secondary is not None:
|
|
163
|
+
payload["_logo_clr_sec"] = str(logo_color_secondary)
|
|
164
|
+
if min_join_value is not None:
|
|
165
|
+
payload["_min_join_value"] = str(min_join_value)
|
|
166
|
+
if currency is not None:
|
|
167
|
+
payload["currency"] = str(currency)
|
|
168
|
+
if active_clan_label is not None:
|
|
169
|
+
payload["active_clan_label"] = "true" if active_clan_label else "false"
|
|
170
|
+
if privacy is not None:
|
|
171
|
+
payload["privacy"] = privacy
|
|
172
|
+
if tags is not None:
|
|
173
|
+
payload["tags"] = ",".join(tags)
|
|
174
|
+
|
|
175
|
+
return self._make_request("POST", url, data=payload)
|
|
176
|
+
|
|
177
|
+
def get_all_squads(
|
|
178
|
+
self,
|
|
179
|
+
limit: int = 100,
|
|
180
|
+
offset: int = 0,
|
|
181
|
+
include_fields: Optional[List[str]] = None
|
|
182
|
+
) -> Dict[str, Any]:
|
|
183
|
+
"""
|
|
184
|
+
Get all squads with storage information.
|
|
185
|
+
|
|
186
|
+
Args:
|
|
187
|
+
limit: Number of squads to retrieve
|
|
188
|
+
offset: Offset for pagination
|
|
189
|
+
include_fields: Fields to include in response
|
|
190
|
+
|
|
191
|
+
Returns:
|
|
192
|
+
List of squads with storage information
|
|
193
|
+
"""
|
|
194
|
+
self._ensure_storage_scope("storage")
|
|
195
|
+
|
|
196
|
+
url = f"{self._storage_base_url}/groups"
|
|
197
|
+
params = {
|
|
198
|
+
"access_token": self._token_data['access_token'],
|
|
199
|
+
"game": "mc5_system",
|
|
200
|
+
"limit": str(limit),
|
|
201
|
+
"offset": str(offset)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
if include_fields:
|
|
205
|
+
params["include_fields"] = ",".join(include_fields)
|
|
206
|
+
|
|
207
|
+
return self._make_request("GET", url, params=params)
|
|
208
|
+
|
|
209
|
+
def batch_delete_squads(
|
|
210
|
+
self,
|
|
211
|
+
squad_ids: List[str]
|
|
212
|
+
) -> Dict[str, Any]:
|
|
213
|
+
"""
|
|
214
|
+
Delete multiple squads at once (requires storage_admin scope).
|
|
215
|
+
|
|
216
|
+
Args:
|
|
217
|
+
squad_ids: List of squad IDs to delete
|
|
218
|
+
|
|
219
|
+
Returns:
|
|
220
|
+
Batch deletion response
|
|
221
|
+
"""
|
|
222
|
+
self._ensure_storage_scope("storage_admin")
|
|
223
|
+
|
|
224
|
+
results = {}
|
|
225
|
+
for squad_id in squad_ids:
|
|
226
|
+
try:
|
|
227
|
+
result = self.delete_squad(squad_id)
|
|
228
|
+
results[squad_id] = {"status": "success", "response": result}
|
|
229
|
+
except Exception as e:
|
|
230
|
+
results[squad_id] = {"status": "error", "error": str(e)}
|
|
231
|
+
|
|
232
|
+
return results
|
|
233
|
+
|
|
234
|
+
def get_squad_audit_log(
|
|
235
|
+
self,
|
|
236
|
+
squad_id: str,
|
|
237
|
+
limit: int = 50
|
|
238
|
+
) -> Dict[str, Any]:
|
|
239
|
+
"""
|
|
240
|
+
Get audit log for a squad (requires storage_admin scope).
|
|
241
|
+
|
|
242
|
+
Args:
|
|
243
|
+
squad_id: Squad ID to get audit log for
|
|
244
|
+
limit: Number of audit entries to retrieve
|
|
245
|
+
|
|
246
|
+
Returns:
|
|
247
|
+
Audit log entries
|
|
248
|
+
"""
|
|
249
|
+
self._ensure_storage_scope("storage_admin")
|
|
250
|
+
|
|
251
|
+
url = f"{self._storage_base_url}/groups/{squad_id}/audit"
|
|
252
|
+
params = {
|
|
253
|
+
"access_token": self._token_data['access_token'],
|
|
254
|
+
"game": "mc5_system",
|
|
255
|
+
"limit": str(limit)
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return self._make_request("GET", url, params=params)
|
|
259
|
+
|
|
260
|
+
def transfer_squad_ownership(
|
|
261
|
+
self,
|
|
262
|
+
squad_id: str,
|
|
263
|
+
new_owner_credential: str
|
|
264
|
+
) -> Dict[str, Any]:
|
|
265
|
+
"""
|
|
266
|
+
Transfer squad ownership to another user (requires storage_admin scope).
|
|
267
|
+
|
|
268
|
+
Args:
|
|
269
|
+
squad_id: Squad ID to transfer
|
|
270
|
+
new_owner_credential: New owner's credential
|
|
271
|
+
|
|
272
|
+
Returns:
|
|
273
|
+
Transfer response
|
|
274
|
+
"""
|
|
275
|
+
self._ensure_storage_scope("storage_admin")
|
|
276
|
+
|
|
277
|
+
url = f"{self._storage_base_url}/groups/{squad_id}/transfer"
|
|
278
|
+
data = {
|
|
279
|
+
"access_token": self._token_data['access_token'],
|
|
280
|
+
"game": "mc5_system",
|
|
281
|
+
"new_owner": new_owner_credential,
|
|
282
|
+
"timestamp": str(int(time.time()))
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
return self._make_request("POST", url, data=data)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mc5_api_client
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.19
|
|
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
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
mc5_api_client/__init__.py,sha256=
|
|
1
|
+
mc5_api_client/__init__.py,sha256=dwst7ePR-608bLju9sGSZ5XE_5KkyUI3BJJITktpcsU,11942
|
|
2
2
|
mc5_api_client/account.py,sha256=EmydXCsCXaKqMw21oVttQfYuDl50pa2dwhcTeHtnxbQ,14396
|
|
3
3
|
mc5_api_client/account_quick.py,sha256=t4ki4ujYENmcnd_004f0pO9SPxPyCllz4WHpBG9wNbo,10458
|
|
4
4
|
mc5_api_client/admin_client.py,sha256=527aavolxVhY2M5ceFxVbbE5YTczU9Z86Fdt1UzdRZM,15220
|
|
@@ -6,23 +6,27 @@ mc5_api_client/alerts.py,sha256=zW-cEwSSShuHkGxTBQaS8Ynf1a0hh5RMQ0G3WC_ajI0,1322
|
|
|
6
6
|
mc5_api_client/alerts_quick.py,sha256=D1j0RiHteYqoAgc4KYqTxYG1Hkud3b-xWRV_VOUEnY0,7946
|
|
7
7
|
mc5_api_client/auth.py,sha256=z8vmyQIHUdAzk0pUyKCesT8gTv4jboLIFGBxAu1v_-8,13396
|
|
8
8
|
mc5_api_client/cli.py,sha256=6xciRjWkUMOxgxlbDsoOiHRuirXPy7uc9WURXPKmgGc,17255
|
|
9
|
-
mc5_api_client/client.py,sha256=
|
|
9
|
+
mc5_api_client/client.py,sha256=EWL0IWiP9mwr9GTnnzWwTKHZUPe2LXaY7YxzjKTDjWM,112524
|
|
10
10
|
mc5_api_client/debug.py,sha256=524vNCE7jM_KP5JM81-3eI2cmFBBA-Hf7Uy0cIL75W0,8240
|
|
11
|
+
mc5_api_client/easy_mc5.py,sha256=kfjOJMW-VRAZcXEF1yHiGsACgjb-ZjXGuw1U_gepSQY,24202
|
|
11
12
|
mc5_api_client/exceptions.py,sha256=o7od4GrEIlgq6xSNUjZdh74xoDTytF3PLcMq5ewRiJw,2683
|
|
12
13
|
mc5_api_client/federation.py,sha256=2asesdDm0DjfskYNliM_WueMhGPn66T5QnLjF4wgZJM,10093
|
|
13
14
|
mc5_api_client/federation_quick.py,sha256=t4xGyOIz28OCvkSQusNZLuNb8YPpGwbDrz0dMZPt4Ig,7671
|
|
14
15
|
mc5_api_client/help.py,sha256=sqf3R6VHQuSYLvAMzh8nXAgCX5URsvXydvw8P0ATabg,7246
|
|
15
|
-
mc5_api_client/
|
|
16
|
+
mc5_api_client/pc_storage_client.py,sha256=MU5Rs-yyV4yzwqBH6P6MavqwWauikBZTMBfoaeOa7nY,8454
|
|
17
|
+
mc5_api_client/pc_storage_quick.py,sha256=iIKWeqeLAeeEufEqolgmWXcyI8eRm7yqzsUnqD-IF9E,6420
|
|
18
|
+
mc5_api_client/platform.py,sha256=W1EcUkwHm0YNkDHcFZz6dkLStxqzE3NAwz6aqJ9l02s,4451
|
|
16
19
|
mc5_api_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
20
|
mc5_api_client/simple_client.py,sha256=szjfZR7c8h7Zdd-E3oZGbrkaPQ2ffx8YnkhPNWODsxo,43750
|
|
18
21
|
mc5_api_client/squad_battle.py,sha256=miBrVbWTta71k_xEAgJyNPthxfZy8qBQ-2vNEAtPTXc,18012
|
|
19
22
|
mc5_api_client/squad_battle_quick.py,sha256=ehMtSPnSQiTQYUIY2SvtO6EOXT1HmqI1F9rU9-eIEp4,8363
|
|
23
|
+
mc5_api_client/storage_admin.py,sha256=l-nwskbpa3KpeIoWcwVRicgBSvrTvQ5aE2QU_e366nw,9696
|
|
20
24
|
mc5_api_client/telemetry.py,sha256=k8qOimPg-AKsnMclIgeqYCJ_97j2pWyiN7Lg80D4sKo,13246
|
|
21
25
|
mc5_api_client/transfer.py,sha256=-pln70360mo4cKBQIUzp_wt9ce1Cr4YA6aJDFPKEjzQ,14381
|
|
22
26
|
mc5_api_client/transfer_quick.py,sha256=HhRbp4FVzFwuzHDcqOyYiVjeVEIfgezlWd8SN6sh874,11310
|
|
23
|
-
mc5_api_client-1.0.
|
|
24
|
-
mc5_api_client-1.0.
|
|
25
|
-
mc5_api_client-1.0.
|
|
26
|
-
mc5_api_client-1.0.
|
|
27
|
-
mc5_api_client-1.0.
|
|
28
|
-
mc5_api_client-1.0.
|
|
27
|
+
mc5_api_client-1.0.19.dist-info/licenses/LICENSE,sha256=M0UBQ4B3pB9XcV54_jhVP681xyauF8GB6YK_rKmuXzk,1064
|
|
28
|
+
mc5_api_client-1.0.19.dist-info/METADATA,sha256=eTEmXuKWRw8Z6wtY4bVAtGljnBB_G667PT2wGfnuEuY,80598
|
|
29
|
+
mc5_api_client-1.0.19.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
30
|
+
mc5_api_client-1.0.19.dist-info/entry_points.txt,sha256=2kruOpleFYK3Jl1MoQwGyqCd-Pj4kQWngXmIjnXx_gE,48
|
|
31
|
+
mc5_api_client-1.0.19.dist-info/top_level.txt,sha256=eYJe4ue9j1ig_jFY5Z05mDqpizUEV7TYpk5lBXVd4kA,15
|
|
32
|
+
mc5_api_client-1.0.19.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|