mc5-api-client 1.0.10__py3-none-any.whl → 1.0.11__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 +57 -2
- mc5_api_client/auth.py +92 -0
- mc5_api_client/cli.py +1 -1
- {mc5_api_client-1.0.10.dist-info → mc5_api_client-1.0.11.dist-info}/METADATA +63 -4
- {mc5_api_client-1.0.10.dist-info → mc5_api_client-1.0.11.dist-info}/RECORD +9 -9
- {mc5_api_client-1.0.10.dist-info → mc5_api_client-1.0.11.dist-info}/WHEEL +0 -0
- {mc5_api_client-1.0.10.dist-info → mc5_api_client-1.0.11.dist-info}/entry_points.txt +0 -0
- {mc5_api_client-1.0.10.dist-info → mc5_api_client-1.0.11.dist-info}/licenses/LICENSE +0 -0
- {mc5_api_client-1.0.10.dist-info → mc5_api_client-1.0.11.dist-info}/top_level.txt +0 -0
mc5_api_client/__init__.py
CHANGED
|
@@ -13,7 +13,9 @@ Provides easy access to authentication, profile management, clan operations,
|
|
|
13
13
|
messaging, and more.
|
|
14
14
|
"""
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
from typing import Optional, Dict, Any
|
|
17
|
+
|
|
18
|
+
__version__ = "1.0.11"
|
|
17
19
|
__author__ = "Chizoba"
|
|
18
20
|
__email__ = "chizoba2026@hotmail.com"
|
|
19
21
|
__license__ = "MIT"
|
|
@@ -38,6 +40,57 @@ from .admin_client import (
|
|
|
38
40
|
quick_update_player_score
|
|
39
41
|
)
|
|
40
42
|
|
|
43
|
+
# Encrypted token convenience functions
|
|
44
|
+
from .auth import TokenGenerator
|
|
45
|
+
|
|
46
|
+
def quick_generate_encrypted_token(
|
|
47
|
+
username: str,
|
|
48
|
+
password: str,
|
|
49
|
+
device_id: Optional[str] = None,
|
|
50
|
+
scope: str = "alert auth chat leaderboard_ro lobby message session social config storage_ro tracking_bi feed storage leaderboard_admin social_eve social soc transaction schedule lottery voice matchmaker",
|
|
51
|
+
nonce: str = "*"
|
|
52
|
+
) -> Dict[str, Any]:
|
|
53
|
+
"""
|
|
54
|
+
Quick function to generate and encrypt an access token.
|
|
55
|
+
|
|
56
|
+
Args:
|
|
57
|
+
username: MC5 username
|
|
58
|
+
password: Account password
|
|
59
|
+
device_id: Device ID (generated if not provided)
|
|
60
|
+
scope: Permission scopes
|
|
61
|
+
nonce: Nonce value for encryption
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
Dictionary containing encrypted token information
|
|
65
|
+
"""
|
|
66
|
+
token_gen = TokenGenerator()
|
|
67
|
+
try:
|
|
68
|
+
result = token_gen.generate_encrypted_token(username, password, device_id, scope, nonce)
|
|
69
|
+
return result
|
|
70
|
+
finally:
|
|
71
|
+
token_gen.close()
|
|
72
|
+
|
|
73
|
+
def quick_encrypt_token(
|
|
74
|
+
access_token: str,
|
|
75
|
+
nonce: str = "*"
|
|
76
|
+
) -> str:
|
|
77
|
+
"""
|
|
78
|
+
Quick function to encrypt an existing access token.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
access_token: Raw access token string
|
|
82
|
+
nonce: Nonce value for encryption
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
Encrypted token string
|
|
86
|
+
"""
|
|
87
|
+
token_gen = TokenGenerator()
|
|
88
|
+
try:
|
|
89
|
+
result = token_gen.encrypt_token(access_token, nonce)
|
|
90
|
+
return result
|
|
91
|
+
finally:
|
|
92
|
+
token_gen.close()
|
|
93
|
+
|
|
41
94
|
__all__ = [
|
|
42
95
|
"MC5Client",
|
|
43
96
|
"SimpleMC5Client",
|
|
@@ -57,5 +110,7 @@ __all__ = [
|
|
|
57
110
|
"RateLimitError",
|
|
58
111
|
"help",
|
|
59
112
|
"examples",
|
|
60
|
-
"quick_reference"
|
|
113
|
+
"quick_reference",
|
|
114
|
+
"quick_generate_encrypted_token",
|
|
115
|
+
"quick_encrypt_token"
|
|
61
116
|
]
|
mc5_api_client/auth.py
CHANGED
|
@@ -38,6 +38,7 @@ class TokenGenerator:
|
|
|
38
38
|
self,
|
|
39
39
|
client_id: str = "1875:55979:6.0.0a:windows:windows",
|
|
40
40
|
auth_url: str = "https://eur-janus.gameloft.com:443/authorize",
|
|
41
|
+
encrypt_url: str = "https://eur-janus.gameloft.com/encrypt_token",
|
|
41
42
|
timeout: int = 30,
|
|
42
43
|
max_retries: int = 3
|
|
43
44
|
):
|
|
@@ -47,11 +48,13 @@ class TokenGenerator:
|
|
|
47
48
|
Args:
|
|
48
49
|
client_id: Game client identifier
|
|
49
50
|
auth_url: Authentication endpoint URL
|
|
51
|
+
encrypt_url: Token encryption endpoint URL
|
|
50
52
|
timeout: Request timeout in seconds
|
|
51
53
|
max_retries: Maximum number of retry attempts
|
|
52
54
|
"""
|
|
53
55
|
self.client_id = client_id
|
|
54
56
|
self.auth_url = auth_url
|
|
57
|
+
self.encrypt_url = encrypt_url
|
|
55
58
|
self.timeout = timeout
|
|
56
59
|
self.max_retries = max_retries
|
|
57
60
|
|
|
@@ -275,6 +278,95 @@ class TokenGenerator:
|
|
|
275
278
|
"signature": parts[6] if len(parts) > 6 else None
|
|
276
279
|
}
|
|
277
280
|
|
|
281
|
+
def encrypt_token(
|
|
282
|
+
self,
|
|
283
|
+
access_token: str,
|
|
284
|
+
nonce: str = "*"
|
|
285
|
+
) -> str:
|
|
286
|
+
"""
|
|
287
|
+
Encrypt an access token for additional security.
|
|
288
|
+
|
|
289
|
+
Args:
|
|
290
|
+
access_token: Raw access token string
|
|
291
|
+
nonce: Nonce value for encryption (default: "*")
|
|
292
|
+
|
|
293
|
+
Returns:
|
|
294
|
+
Encrypted token string
|
|
295
|
+
|
|
296
|
+
Raises:
|
|
297
|
+
AuthenticationError: If encryption fails
|
|
298
|
+
NetworkError: If network issues occur
|
|
299
|
+
"""
|
|
300
|
+
payload = {
|
|
301
|
+
"access_token": access_token,
|
|
302
|
+
"nonce": nonce
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
try:
|
|
306
|
+
print("🔐 Encrypting token...")
|
|
307
|
+
response = self.session.post(
|
|
308
|
+
self.encrypt_url,
|
|
309
|
+
data=payload,
|
|
310
|
+
timeout=self.timeout
|
|
311
|
+
)
|
|
312
|
+
|
|
313
|
+
if response.status_code == 200:
|
|
314
|
+
encrypted_token = response.text.strip()
|
|
315
|
+
if encrypted_token:
|
|
316
|
+
print("✅ Token encrypted successfully")
|
|
317
|
+
return encrypted_token
|
|
318
|
+
else:
|
|
319
|
+
raise AuthenticationError("Empty encrypted token response")
|
|
320
|
+
else:
|
|
321
|
+
raise AuthenticationError(
|
|
322
|
+
f"Token encryption failed with status {response.status_code}: {response.text}"
|
|
323
|
+
)
|
|
324
|
+
|
|
325
|
+
except requests.exceptions.Timeout:
|
|
326
|
+
raise NetworkError("Token encryption request timed out")
|
|
327
|
+
except requests.exceptions.ConnectionError:
|
|
328
|
+
raise NetworkError("Failed to connect to encryption server")
|
|
329
|
+
except requests.exceptions.RequestException as e:
|
|
330
|
+
raise NetworkError(f"Network error during token encryption: {e}")
|
|
331
|
+
|
|
332
|
+
def generate_encrypted_token(
|
|
333
|
+
self,
|
|
334
|
+
username: str,
|
|
335
|
+
password: str,
|
|
336
|
+
device_id: Optional[str] = None,
|
|
337
|
+
scope: str = "alert auth chat leaderboard_ro lobby message session social config storage_ro tracking_bi feed storage leaderboard_admin social_eve social soc transaction schedule lottery voice matchmaker",
|
|
338
|
+
nonce: str = "*"
|
|
339
|
+
) -> Dict[str, Any]:
|
|
340
|
+
"""
|
|
341
|
+
Generate and encrypt an access token in one step.
|
|
342
|
+
|
|
343
|
+
Args:
|
|
344
|
+
username: MC5 username
|
|
345
|
+
password: Account password
|
|
346
|
+
device_id: Device ID (generated if not provided)
|
|
347
|
+
scope: Space-separated list of permission scopes
|
|
348
|
+
nonce: Nonce value for encryption (default: "*")
|
|
349
|
+
|
|
350
|
+
Returns:
|
|
351
|
+
Dictionary containing encrypted token information
|
|
352
|
+
|
|
353
|
+
Raises:
|
|
354
|
+
InvalidCredentialsError: If credentials are invalid
|
|
355
|
+
AuthenticationError: If authentication or encryption fails
|
|
356
|
+
NetworkError: If network issues occur
|
|
357
|
+
"""
|
|
358
|
+
# First generate regular token
|
|
359
|
+
token_data = self.generate_token(username, password, device_id, scope)
|
|
360
|
+
|
|
361
|
+
# Then encrypt it
|
|
362
|
+
encrypted_token = self.encrypt_token(token_data["access_token"], nonce)
|
|
363
|
+
|
|
364
|
+
# Add encrypted token to result
|
|
365
|
+
token_data["encrypted_token"] = encrypted_token
|
|
366
|
+
token_data["nonce"] = nonce
|
|
367
|
+
|
|
368
|
+
return token_data
|
|
369
|
+
|
|
278
370
|
def close(self):
|
|
279
371
|
"""Close the HTTP session."""
|
|
280
372
|
if self.session:
|
mc5_api_client/cli.py
CHANGED
|
@@ -447,7 +447,7 @@ class MC5CLI:
|
|
|
447
447
|
|
|
448
448
|
def _print_version(self):
|
|
449
449
|
"""Print version information."""
|
|
450
|
-
self._print("MC5 API Client v1.0.
|
|
450
|
+
self._print("MC5 API Client v1.0.11", "cyan")
|
|
451
451
|
self._print("The ultimate Modern Combat 5 API library", "green")
|
|
452
452
|
self._print("Author: Chizoba", "blue")
|
|
453
453
|
self._print("Email: chizoba2026@hotmail.com", "blue")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mc5_api_client
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.11
|
|
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
|
|
@@ -413,15 +413,16 @@ try: except MC5APIError:
|
|
|
413
413
|
### **🚀 Install from PyPI (Recommended)**
|
|
414
414
|
|
|
415
415
|
```bash
|
|
416
|
-
pip install mc5_api_client==1.0.
|
|
416
|
+
pip install mc5_api_client==1.0.10
|
|
417
417
|
```
|
|
418
418
|
|
|
419
|
-
✅ **Published and Available!** The MC5 API Client v1.0.
|
|
419
|
+
✅ **Published and Available!** The MC5 API Client v1.0.10 is now live on PyPI with advanced automation features and admin capabilities!
|
|
420
420
|
|
|
421
421
|
### **� Install from Local Package**
|
|
422
422
|
|
|
423
423
|
```bash
|
|
424
424
|
# Install the wheel file you just created
|
|
425
|
+
pip install dist/mc5_api_client-1.0.10-py3-none-any.whl
|
|
425
426
|
pip install dist/mc5_api_client-1.0.8-py3-none-any.whl
|
|
426
427
|
|
|
427
428
|
# Or install from source
|
|
@@ -809,7 +810,65 @@ for event in events:
|
|
|
809
810
|
print(f" Task {i+1}: {points} points")
|
|
810
811
|
```
|
|
811
812
|
|
|
812
|
-
###
|
|
813
|
+
### 🔐 **Encrypted Token Support**
|
|
814
|
+
|
|
815
|
+
For users who prefer additional security, the module now supports token encryption:
|
|
816
|
+
|
|
817
|
+
```python
|
|
818
|
+
from mc5_api_client import quick_generate_encrypted_token, quick_encrypt_token
|
|
819
|
+
|
|
820
|
+
# Generate and encrypt a token in one step
|
|
821
|
+
encrypted_data = quick_generate_encrypted_token(
|
|
822
|
+
username="anonymous:d2luOF92M18xNzcwMDUxNjkwXy7H33aeTVB4YZictyDq48c=",
|
|
823
|
+
password="sSJKzhQ5l4vrFgov",
|
|
824
|
+
nonce="*" # Custom nonce value (optional)
|
|
825
|
+
)
|
|
826
|
+
|
|
827
|
+
print(f"Token ID: {encrypted_data['token_id']}")
|
|
828
|
+
print(f"Encrypted Token: {encrypted_data['encrypted_token']}")
|
|
829
|
+
print(f"Expires: {encrypted_data['expires_at']}")
|
|
830
|
+
|
|
831
|
+
# Encrypt an existing token
|
|
832
|
+
existing_token = "your_raw_access_token_here"
|
|
833
|
+
encrypted_token = quick_encrypt_token(existing_token, "*")
|
|
834
|
+
print(f"Encrypted: {encrypted_token}")
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
**Advanced TokenGenerator Usage:**
|
|
838
|
+
|
|
839
|
+
```python
|
|
840
|
+
from mc5_api_client import TokenGenerator
|
|
841
|
+
|
|
842
|
+
# Create token generator with custom settings
|
|
843
|
+
token_gen = TokenGenerator(
|
|
844
|
+
encrypt_url="https://eur-janus.gameloft.com/encrypt_token"
|
|
845
|
+
)
|
|
846
|
+
|
|
847
|
+
try:
|
|
848
|
+
# Generate encrypted token
|
|
849
|
+
result = token_gen.generate_encrypted_token(
|
|
850
|
+
username="anonymous:credential",
|
|
851
|
+
password="password",
|
|
852
|
+
nonce="custom_nonce"
|
|
853
|
+
)
|
|
854
|
+
|
|
855
|
+
# Or encrypt existing token
|
|
856
|
+
encrypted = token_gen.encrypt_token(
|
|
857
|
+
access_token="raw_token",
|
|
858
|
+
nonce="custom_nonce"
|
|
859
|
+
)
|
|
860
|
+
|
|
861
|
+
finally:
|
|
862
|
+
token_gen.close() # Always close the session
|
|
863
|
+
```
|
|
864
|
+
|
|
865
|
+
**Security Benefits:**
|
|
866
|
+
- ✅ **Additional Layer**: Tokens are encrypted before transmission
|
|
867
|
+
- ✅ **Custom Nonce**: Support for custom nonce values
|
|
868
|
+
- ✅ **Backward Compatible**: Works with existing authentication flow
|
|
869
|
+
- ✅ **Error Handling**: Proper validation and error recovery
|
|
870
|
+
|
|
871
|
+
### 🏆 **Checking Leaderboards**
|
|
813
872
|
|
|
814
873
|
See how you stack up:
|
|
815
874
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
mc5_api_client/__init__.py,sha256=
|
|
1
|
+
mc5_api_client/__init__.py,sha256=vJQmJ58TMBZ6Qeko7J9mQJht_71bwc7obVQtNrvkFQY,3296
|
|
2
2
|
mc5_api_client/admin_client.py,sha256=527aavolxVhY2M5ceFxVbbE5YTczU9Z86Fdt1UzdRZM,15220
|
|
3
|
-
mc5_api_client/auth.py,sha256=
|
|
4
|
-
mc5_api_client/cli.py,sha256=
|
|
3
|
+
mc5_api_client/auth.py,sha256=z8vmyQIHUdAzk0pUyKCesT8gTv4jboLIFGBxAu1v_-8,13396
|
|
4
|
+
mc5_api_client/cli.py,sha256=D5RTwRQJz86xf8Ocqj0Zr4O3BjPIj6_kbChEeF-ha5g,17255
|
|
5
5
|
mc5_api_client/client.py,sha256=q5PkdpTXjWCXdLFiK1-zqa7fThJGE4Z99A3ccMfwJIY,79239
|
|
6
6
|
mc5_api_client/exceptions.py,sha256=o7od4GrEIlgq6xSNUjZdh74xoDTytF3PLcMq5ewRiJw,2683
|
|
7
7
|
mc5_api_client/help.py,sha256=sqf3R6VHQuSYLvAMzh8nXAgCX5URsvXydvw8P0ATabg,7246
|
|
8
8
|
mc5_api_client/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
mc5_api_client/simple_client.py,sha256=31JI2rURHIXKcnDXQYJNpr-gypweO56ANFdhD-Z4Ft0,20241
|
|
10
|
-
mc5_api_client-1.0.
|
|
11
|
-
mc5_api_client-1.0.
|
|
12
|
-
mc5_api_client-1.0.
|
|
13
|
-
mc5_api_client-1.0.
|
|
14
|
-
mc5_api_client-1.0.
|
|
15
|
-
mc5_api_client-1.0.
|
|
10
|
+
mc5_api_client-1.0.11.dist-info/licenses/LICENSE,sha256=M0UBQ4B3pB9XcV54_jhVP681xyauF8GB6YK_rKmuXzk,1064
|
|
11
|
+
mc5_api_client-1.0.11.dist-info/METADATA,sha256=q6squlB7kiIgfioZBPKfPWniTFXoV8I-2rTKgZQyX6k,54718
|
|
12
|
+
mc5_api_client-1.0.11.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
13
|
+
mc5_api_client-1.0.11.dist-info/entry_points.txt,sha256=2kruOpleFYK3Jl1MoQwGyqCd-Pj4kQWngXmIjnXx_gE,48
|
|
14
|
+
mc5_api_client-1.0.11.dist-info/top_level.txt,sha256=eYJe4ue9j1ig_jFY5Z05mDqpizUEV7TYpk5lBXVd4kA,15
|
|
15
|
+
mc5_api_client-1.0.11.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|