mc5-api-client 1.0.18__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 +5 -1
- mc5_api_client/client.py +68 -15
- {mc5_api_client-1.0.18.dist-info → mc5_api_client-1.0.19.dist-info}/METADATA +1 -1
- {mc5_api_client-1.0.18.dist-info → mc5_api_client-1.0.19.dist-info}/RECORD +8 -8
- {mc5_api_client-1.0.18.dist-info → mc5_api_client-1.0.19.dist-info}/WHEEL +0 -0
- {mc5_api_client-1.0.18.dist-info → mc5_api_client-1.0.19.dist-info}/entry_points.txt +0 -0
- {mc5_api_client-1.0.18.dist-info → mc5_api_client-1.0.19.dist-info}/licenses/LICENSE +0 -0
- {mc5_api_client-1.0.18.dist-info → mc5_api_client-1.0.19.dist-info}/top_level.txt +0 -0
mc5_api_client/__init__.py
CHANGED
|
@@ -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.19"
|
|
19
19
|
__author__ = "Chizoba"
|
|
20
20
|
__email__ = "chizoba2026@hotmail.com"
|
|
21
21
|
__license__ = "MIT"
|
|
@@ -87,6 +87,9 @@ from .client import MC5Client
|
|
|
87
87
|
from .auth import TokenGenerator
|
|
88
88
|
from .exceptions import MC5APIError, AuthenticationError, RateLimitError
|
|
89
89
|
from .help import help, examples, quick_reference
|
|
90
|
+
|
|
91
|
+
# Add MC5ApiClient as an alias for backward compatibility
|
|
92
|
+
MC5ApiClient = MC5Client
|
|
90
93
|
from .admin_client import (
|
|
91
94
|
AdminMC5Client,
|
|
92
95
|
create_admin_client,
|
|
@@ -322,6 +325,7 @@ def encrypt_token(
|
|
|
322
325
|
|
|
323
326
|
__all__ = [
|
|
324
327
|
"MC5Client",
|
|
328
|
+
"MC5ApiClient",
|
|
325
329
|
"SimpleMC5Client",
|
|
326
330
|
"AdminMC5Client",
|
|
327
331
|
"batch_search_players",
|
mc5_api_client/client.py
CHANGED
|
@@ -1573,31 +1573,84 @@ class MC5Client(SquadBattleMixin, FederationMixin, AlertsMixin, AccountMixin, Tr
|
|
|
1573
1573
|
|
|
1574
1574
|
# Utility Methods
|
|
1575
1575
|
|
|
1576
|
-
def
|
|
1576
|
+
def close(self):
|
|
1577
|
+
"""Close the HTTP session and cleanup resources."""
|
|
1578
|
+
if self.session:
|
|
1579
|
+
self.session.close()
|
|
1580
|
+
if self.token_generator:
|
|
1581
|
+
self.token_generator.close()
|
|
1582
|
+
|
|
1583
|
+
# Server Status Methods (for compatibility)
|
|
1584
|
+
|
|
1585
|
+
def get_server_status(self) -> Dict[str, Any]:
|
|
1577
1586
|
"""
|
|
1578
|
-
Get
|
|
1587
|
+
Get server status information.
|
|
1579
1588
|
|
|
1580
1589
|
Returns:
|
|
1581
|
-
|
|
1590
|
+
Dictionary with server status
|
|
1582
1591
|
"""
|
|
1583
|
-
|
|
1584
|
-
|
|
1592
|
+
try:
|
|
1593
|
+
# Try to get events as a basic connectivity test
|
|
1594
|
+
events = self.get_events()
|
|
1595
|
+
return {
|
|
1596
|
+
"status": "online",
|
|
1597
|
+
"message": "MC5 servers are online",
|
|
1598
|
+
"events_count": len(events),
|
|
1599
|
+
"timestamp": time.time()
|
|
1600
|
+
}
|
|
1601
|
+
except Exception as e:
|
|
1602
|
+
return {
|
|
1603
|
+
"status": "offline",
|
|
1604
|
+
"message": f"Server status check failed: {str(e)}",
|
|
1605
|
+
"timestamp": time.time()
|
|
1606
|
+
}
|
|
1585
1607
|
|
|
1586
|
-
def
|
|
1608
|
+
def get_online_players(self) -> Dict[str, Any]:
|
|
1587
1609
|
"""
|
|
1588
|
-
|
|
1610
|
+
Get online players information (estimated).
|
|
1589
1611
|
|
|
1590
1612
|
Returns:
|
|
1591
|
-
|
|
1613
|
+
Dictionary with online player count
|
|
1592
1614
|
"""
|
|
1593
|
-
|
|
1615
|
+
try:
|
|
1616
|
+
# Get events as a proxy for activity
|
|
1617
|
+
events = self.get_events()
|
|
1618
|
+
# This is an estimate - actual player count isn't directly available
|
|
1619
|
+
return {
|
|
1620
|
+
"online_players": "Unknown",
|
|
1621
|
+
"active_events": len(events),
|
|
1622
|
+
"message": "Player count not directly available via API",
|
|
1623
|
+
"timestamp": time.time()
|
|
1624
|
+
}
|
|
1625
|
+
except Exception as e:
|
|
1626
|
+
return {
|
|
1627
|
+
"online_players": 0,
|
|
1628
|
+
"error": str(e),
|
|
1629
|
+
"timestamp": time.time()
|
|
1630
|
+
}
|
|
1594
1631
|
|
|
1595
|
-
def
|
|
1596
|
-
"""
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1632
|
+
def get_server_info(self) -> Dict[str, Any]:
|
|
1633
|
+
"""
|
|
1634
|
+
Get general server information.
|
|
1635
|
+
|
|
1636
|
+
Returns:
|
|
1637
|
+
Dictionary with server information
|
|
1638
|
+
"""
|
|
1639
|
+
try:
|
|
1640
|
+
return {
|
|
1641
|
+
"server": "Modern Combat 5",
|
|
1642
|
+
"region": "Europe",
|
|
1643
|
+
"api_version": "1.0.18",
|
|
1644
|
+
"endpoints": list(self.BASE_URLS.keys()),
|
|
1645
|
+
"client_id": self.client_id,
|
|
1646
|
+
"authenticated": bool(self.access_token),
|
|
1647
|
+
"timestamp": time.time()
|
|
1648
|
+
}
|
|
1649
|
+
except Exception as e:
|
|
1650
|
+
return {
|
|
1651
|
+
"error": str(e),
|
|
1652
|
+
"timestamp": time.time()
|
|
1653
|
+
}
|
|
1601
1654
|
|
|
1602
1655
|
# Events API
|
|
1603
1656
|
|
|
@@ -1,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,7 +6,7 @@ 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
11
|
mc5_api_client/easy_mc5.py,sha256=kfjOJMW-VRAZcXEF1yHiGsACgjb-ZjXGuw1U_gepSQY,24202
|
|
12
12
|
mc5_api_client/exceptions.py,sha256=o7od4GrEIlgq6xSNUjZdh74xoDTytF3PLcMq5ewRiJw,2683
|
|
@@ -24,9 +24,9 @@ mc5_api_client/storage_admin.py,sha256=l-nwskbpa3KpeIoWcwVRicgBSvrTvQ5aE2QU_e366
|
|
|
24
24
|
mc5_api_client/telemetry.py,sha256=k8qOimPg-AKsnMclIgeqYCJ_97j2pWyiN7Lg80D4sKo,13246
|
|
25
25
|
mc5_api_client/transfer.py,sha256=-pln70360mo4cKBQIUzp_wt9ce1Cr4YA6aJDFPKEjzQ,14381
|
|
26
26
|
mc5_api_client/transfer_quick.py,sha256=HhRbp4FVzFwuzHDcqOyYiVjeVEIfgezlWd8SN6sh874,11310
|
|
27
|
-
mc5_api_client-1.0.
|
|
28
|
-
mc5_api_client-1.0.
|
|
29
|
-
mc5_api_client-1.0.
|
|
30
|
-
mc5_api_client-1.0.
|
|
31
|
-
mc5_api_client-1.0.
|
|
32
|
-
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
|