mc5-api-client 1.0.2__tar.gz → 1.0.3__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.2 → mc5_api_client-1.0.3}/CHANGELOG.md +3 -2
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/PKG-INFO +66 -22
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/README.md +65 -21
- mc5_api_client-1.0.3/examples/advanced_features.py +269 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/pyproject.toml +1 -1
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/setup.py +1 -1
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/src/mc5_api_client/client.py +513 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/src/mc5_api_client.egg-info/PKG-INFO +66 -22
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/src/mc5_api_client.egg-info/SOURCES.txt +1 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/.gitignore +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/LICENSE +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/MANIFEST.in +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/examples/basic_usage.py +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/examples/clan_management.py +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/examples/clan_management_complete.py +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/examples/events_and_tasks.py +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/examples/message_management.py +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/examples/private_messaging.py +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/examples/squad_management.py +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/examples/squad_wall_management.py +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/pytest.ini +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/requirements-dev.txt +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/requirements.txt +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/setup.cfg +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/src/mc5_api_client/__init__.py +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/src/mc5_api_client/auth.py +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/src/mc5_api_client/cli.py +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/src/mc5_api_client/exceptions.py +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/src/mc5_api_client/py.typed +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/src/mc5_api_client.egg-info/dependency_links.txt +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/src/mc5_api_client.egg-info/entry_points.txt +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/src/mc5_api_client.egg-info/not-zip-safe +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/src/mc5_api_client.egg-info/requires.txt +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/src/mc5_api_client.egg-info/top_level.txt +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/tests/__init__.py +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/tests/test_auth.py +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/tests/test_cli.py +0 -0
- {mc5_api_client-1.0.2 → mc5_api_client-1.0.3}/tests/test_client.py +0 -0
|
@@ -19,8 +19,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
19
19
|
- Messaging system
|
|
20
20
|
- Events and tasks
|
|
21
21
|
- Leaderboard access
|
|
22
|
-
- Game
|
|
23
|
-
-
|
|
22
|
+
- Game objects
|
|
23
|
+
- Asset metadata
|
|
24
|
+
- Alias lookup
|
|
24
25
|
- Automatic token refresh functionality
|
|
25
26
|
- Comprehensive error handling with custom exceptions
|
|
26
27
|
- Type hints throughout the codebase
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mc5_api_client
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.3
|
|
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
|
|
@@ -122,13 +122,6 @@ pip install .
|
|
|
122
122
|
|
|
123
123
|
### 🔧 Build Status
|
|
124
124
|
|
|
125
|
-
✅ **Compilation Successful** - No critical errors
|
|
126
|
-
⚠️ **Warnings Fixed** - Configuration warnings resolved
|
|
127
|
-
✅ **All Examples Included** - 7 comprehensive example scripts
|
|
128
|
-
✅ **CLI Entry Points** - `mc5` command available
|
|
129
|
-
✅ **Dependencies Managed** - All requirements included
|
|
130
|
-
|
|
131
|
-
## �� Let's Get Started!
|
|
132
125
|
|
|
133
126
|
### Step 1: Install the Library
|
|
134
127
|
|
|
@@ -138,24 +131,31 @@ Just run this in your terminal (Command Prompt/PowerShell):
|
|
|
138
131
|
pip install mc5_api_client
|
|
139
132
|
```
|
|
140
133
|
|
|
141
|
-
|
|
134
|
+
### Step 2: Verify Installation
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Check the CLI
|
|
138
|
+
mc5 --help
|
|
139
|
+
mc5 version
|
|
140
|
+
|
|
141
|
+
# Test in Python
|
|
142
|
+
python -c "import mc5_api_client; print('✅ MC5 API Client ready!')"
|
|
143
|
+
```
|
|
142
144
|
|
|
143
|
-
### Step
|
|
145
|
+
### Step 3: Your First Program
|
|
144
146
|
|
|
145
|
-
|
|
147
|
+
Copy and paste this simple example to get started:
|
|
146
148
|
|
|
147
149
|
```python
|
|
150
|
+
# Save this as my_mc5_script.py
|
|
148
151
|
from mc5_api_client import MC5Client
|
|
149
152
|
|
|
150
|
-
#
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
password="YOUR_PASSWORD_HERE"
|
|
154
|
-
)
|
|
153
|
+
# Replace with your actual credentials
|
|
154
|
+
username = "YOUR_USERNAME_HERE"
|
|
155
|
+
password = "YOUR_PASSWORD_HERE"
|
|
155
156
|
|
|
156
|
-
#
|
|
157
|
-
|
|
158
|
-
print(f"Hey {profile['name']}! You're level {profile['level']}")
|
|
157
|
+
# Create client and login
|
|
158
|
+
client = MC5Client(username=username, password=password)
|
|
159
159
|
|
|
160
160
|
# See what's happening in the game
|
|
161
161
|
events = client.get_events()
|
|
@@ -941,6 +941,7 @@ The library comes with comprehensive examples to get you started:
|
|
|
941
941
|
- `examples/squad_wall_management.py` - Squad wall communication examples
|
|
942
942
|
- `examples/private_messaging.py` - Private messaging and inbox management
|
|
943
943
|
- `examples/message_management.py` - Advanced message management and bulk deletion
|
|
944
|
+
- `examples/advanced_features.py` - Events, account management, alias system, game config
|
|
944
945
|
|
|
945
946
|
### 🚀 Advanced Examples
|
|
946
947
|
- Squad management bot with automated updates
|
|
@@ -988,6 +989,45 @@ The library comes with comprehensive examples to get you started:
|
|
|
988
989
|
- ✅ Bulk stat updates
|
|
989
990
|
- ✅ Real-time activity monitoring
|
|
990
991
|
|
|
992
|
+
### � Events API (10+ Methods)
|
|
993
|
+
- ✅ Get all active and upcoming events
|
|
994
|
+
- ✅ Filter events by type and status
|
|
995
|
+
- ✅ Get detailed event information with tasks and milestones
|
|
996
|
+
- ✅ Parse event templates and extract rewards
|
|
997
|
+
- ✅ Get daily tasks with progress tracking
|
|
998
|
+
- ✅ Get squad events and tournament information
|
|
999
|
+
- ✅ Calculate event rewards based on current points
|
|
1000
|
+
- ✅ Track event progress and next milestones
|
|
1001
|
+
- ✅ Extract task conditions and reward types
|
|
1002
|
+
- ✅ Support for multiple event categories
|
|
1003
|
+
|
|
1004
|
+
### 👤 Account Management (5+ Methods)
|
|
1005
|
+
- ✅ Import account data from other platforms
|
|
1006
|
+
- ✅ Link accounts across different platforms
|
|
1007
|
+
- ✅ Get detailed account information
|
|
1008
|
+
- ✅ Unlink platform accounts
|
|
1009
|
+
- ✅ Migrate account data between platforms
|
|
1010
|
+
- ✅ Support for cross-platform data transfer
|
|
1011
|
+
- ✅ Account verification and validation
|
|
1012
|
+
|
|
1013
|
+
### 🏷️ Alias/Dogtags System (4+ Methods)
|
|
1014
|
+
- ✅ Convert dogtags to alias format
|
|
1015
|
+
- ✅ Convert aliases back to dogtags
|
|
1016
|
+
- ✅ Get player information using alias/dogtag
|
|
1017
|
+
- ✅ Search for players by alias
|
|
1018
|
+
- ✅ Support for hexadecimal player IDs
|
|
1019
|
+
- ✅ Automatic format detection
|
|
1020
|
+
- ✅ Mathematical conversion algorithms
|
|
1021
|
+
|
|
1022
|
+
### ⚙️ Game Configuration (4+ Methods)
|
|
1023
|
+
- ✅ Get asset hash metadata
|
|
1024
|
+
- ✅ Get game object catalog
|
|
1025
|
+
- ✅ Get service URLs for current region
|
|
1026
|
+
- ✅ Get comprehensive game configuration
|
|
1027
|
+
- ✅ Support for multiple config types
|
|
1028
|
+
- ✅ Asset metadata tracking
|
|
1029
|
+
- ✅ Service URL management
|
|
1030
|
+
- ✅ Game object categorization
|
|
991
1031
|
### 💬 Complete Communication System (6+ Methods)
|
|
992
1032
|
- ✅ Send private messages with rich formatting
|
|
993
1033
|
- ✅ Include kill signatures and colors
|
|
@@ -1099,18 +1139,20 @@ Stuck on something? No worries!
|
|
|
1099
1139
|
|
|
1100
1140
|
## 🔗 Useful Links
|
|
1101
1141
|
|
|
1102
|
-
This is the **most comprehensive Modern Combat 5 API library** ever created! With **
|
|
1142
|
+
This is the **most comprehensive Modern Combat 5 API library** ever created! With **95+ methods** across **14 major categories**, you can:
|
|
1103
1143
|
|
|
1104
1144
|
- 🏰 **Manage entire clans** from creation to disbandment
|
|
1105
1145
|
- 👥 **Control squad members** with real-time stat updates
|
|
1106
1146
|
- 💬 **Complete communication system** - Private messages, squad wall, alerts
|
|
1147
|
+
- 📅 **Advanced events system** - Daily tasks, squad events, milestones
|
|
1148
|
+
- 👤 **Account management** - Import, link, migrate across platforms
|
|
1149
|
+
- 🏷️ **Alias/dogtags system** - Player ID conversion and search
|
|
1150
|
+
- ⚙️ **Game configuration** - Assets, catalogs, service URLs
|
|
1107
1151
|
- 🎯 **Customize everything** with kill signatures and rich formatting
|
|
1108
1152
|
- 📊 **Track performance** with detailed analytics
|
|
1109
1153
|
- 🎮 **Automate gameplay** with custom bots and scripts
|
|
1110
1154
|
- 🏆 **Create leaderboards** and ranking systems
|
|
1111
1155
|
- 🔄 **Schedule tasks** and monitor activity
|
|
1112
|
-
- 📱 **Manage messages** with inbox and reply systems
|
|
1113
|
-
|
|
1114
1156
|
|
|
1115
1157
|
**Perfect for:**
|
|
1116
1158
|
- 🏆 Squad leaders who want to automate management
|
|
@@ -1121,6 +1163,8 @@ This is the **most comprehensive Modern Combat 5 API library** ever created! Wit
|
|
|
1121
1163
|
- 🏅 Competitive players seeking advantages
|
|
1122
1164
|
- 💬 Community managers handling communications
|
|
1123
1165
|
- 📧 Support teams providing assistance
|
|
1166
|
+
- 📅 Event coordinators managing tournaments
|
|
1167
|
+
- 🏷️ Player search and identification systems
|
|
1124
1168
|
|
|
1125
1169
|
**Ready to dominate Modern Combat 5?** 🚀
|
|
1126
1170
|
|
|
@@ -63,13 +63,6 @@ pip install .
|
|
|
63
63
|
|
|
64
64
|
### 🔧 Build Status
|
|
65
65
|
|
|
66
|
-
✅ **Compilation Successful** - No critical errors
|
|
67
|
-
⚠️ **Warnings Fixed** - Configuration warnings resolved
|
|
68
|
-
✅ **All Examples Included** - 7 comprehensive example scripts
|
|
69
|
-
✅ **CLI Entry Points** - `mc5` command available
|
|
70
|
-
✅ **Dependencies Managed** - All requirements included
|
|
71
|
-
|
|
72
|
-
## �� Let's Get Started!
|
|
73
66
|
|
|
74
67
|
### Step 1: Install the Library
|
|
75
68
|
|
|
@@ -79,24 +72,31 @@ Just run this in your terminal (Command Prompt/PowerShell):
|
|
|
79
72
|
pip install mc5_api_client
|
|
80
73
|
```
|
|
81
74
|
|
|
82
|
-
|
|
75
|
+
### Step 2: Verify Installation
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Check the CLI
|
|
79
|
+
mc5 --help
|
|
80
|
+
mc5 version
|
|
81
|
+
|
|
82
|
+
# Test in Python
|
|
83
|
+
python -c "import mc5_api_client; print('✅ MC5 API Client ready!')"
|
|
84
|
+
```
|
|
83
85
|
|
|
84
|
-
### Step
|
|
86
|
+
### Step 3: Your First Program
|
|
85
87
|
|
|
86
|
-
|
|
88
|
+
Copy and paste this simple example to get started:
|
|
87
89
|
|
|
88
90
|
```python
|
|
91
|
+
# Save this as my_mc5_script.py
|
|
89
92
|
from mc5_api_client import MC5Client
|
|
90
93
|
|
|
91
|
-
#
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
password="YOUR_PASSWORD_HERE"
|
|
95
|
-
)
|
|
94
|
+
# Replace with your actual credentials
|
|
95
|
+
username = "YOUR_USERNAME_HERE"
|
|
96
|
+
password = "YOUR_PASSWORD_HERE"
|
|
96
97
|
|
|
97
|
-
#
|
|
98
|
-
|
|
99
|
-
print(f"Hey {profile['name']}! You're level {profile['level']}")
|
|
98
|
+
# Create client and login
|
|
99
|
+
client = MC5Client(username=username, password=password)
|
|
100
100
|
|
|
101
101
|
# See what's happening in the game
|
|
102
102
|
events = client.get_events()
|
|
@@ -882,6 +882,7 @@ The library comes with comprehensive examples to get you started:
|
|
|
882
882
|
- `examples/squad_wall_management.py` - Squad wall communication examples
|
|
883
883
|
- `examples/private_messaging.py` - Private messaging and inbox management
|
|
884
884
|
- `examples/message_management.py` - Advanced message management and bulk deletion
|
|
885
|
+
- `examples/advanced_features.py` - Events, account management, alias system, game config
|
|
885
886
|
|
|
886
887
|
### 🚀 Advanced Examples
|
|
887
888
|
- Squad management bot with automated updates
|
|
@@ -929,6 +930,45 @@ The library comes with comprehensive examples to get you started:
|
|
|
929
930
|
- ✅ Bulk stat updates
|
|
930
931
|
- ✅ Real-time activity monitoring
|
|
931
932
|
|
|
933
|
+
### � Events API (10+ Methods)
|
|
934
|
+
- ✅ Get all active and upcoming events
|
|
935
|
+
- ✅ Filter events by type and status
|
|
936
|
+
- ✅ Get detailed event information with tasks and milestones
|
|
937
|
+
- ✅ Parse event templates and extract rewards
|
|
938
|
+
- ✅ Get daily tasks with progress tracking
|
|
939
|
+
- ✅ Get squad events and tournament information
|
|
940
|
+
- ✅ Calculate event rewards based on current points
|
|
941
|
+
- ✅ Track event progress and next milestones
|
|
942
|
+
- ✅ Extract task conditions and reward types
|
|
943
|
+
- ✅ Support for multiple event categories
|
|
944
|
+
|
|
945
|
+
### 👤 Account Management (5+ Methods)
|
|
946
|
+
- ✅ Import account data from other platforms
|
|
947
|
+
- ✅ Link accounts across different platforms
|
|
948
|
+
- ✅ Get detailed account information
|
|
949
|
+
- ✅ Unlink platform accounts
|
|
950
|
+
- ✅ Migrate account data between platforms
|
|
951
|
+
- ✅ Support for cross-platform data transfer
|
|
952
|
+
- ✅ Account verification and validation
|
|
953
|
+
|
|
954
|
+
### 🏷️ Alias/Dogtags System (4+ Methods)
|
|
955
|
+
- ✅ Convert dogtags to alias format
|
|
956
|
+
- ✅ Convert aliases back to dogtags
|
|
957
|
+
- ✅ Get player information using alias/dogtag
|
|
958
|
+
- ✅ Search for players by alias
|
|
959
|
+
- ✅ Support for hexadecimal player IDs
|
|
960
|
+
- ✅ Automatic format detection
|
|
961
|
+
- ✅ Mathematical conversion algorithms
|
|
962
|
+
|
|
963
|
+
### ⚙️ Game Configuration (4+ Methods)
|
|
964
|
+
- ✅ Get asset hash metadata
|
|
965
|
+
- ✅ Get game object catalog
|
|
966
|
+
- ✅ Get service URLs for current region
|
|
967
|
+
- ✅ Get comprehensive game configuration
|
|
968
|
+
- ✅ Support for multiple config types
|
|
969
|
+
- ✅ Asset metadata tracking
|
|
970
|
+
- ✅ Service URL management
|
|
971
|
+
- ✅ Game object categorization
|
|
932
972
|
### 💬 Complete Communication System (6+ Methods)
|
|
933
973
|
- ✅ Send private messages with rich formatting
|
|
934
974
|
- ✅ Include kill signatures and colors
|
|
@@ -1040,18 +1080,20 @@ Stuck on something? No worries!
|
|
|
1040
1080
|
|
|
1041
1081
|
## 🔗 Useful Links
|
|
1042
1082
|
|
|
1043
|
-
This is the **most comprehensive Modern Combat 5 API library** ever created! With **
|
|
1083
|
+
This is the **most comprehensive Modern Combat 5 API library** ever created! With **95+ methods** across **14 major categories**, you can:
|
|
1044
1084
|
|
|
1045
1085
|
- 🏰 **Manage entire clans** from creation to disbandment
|
|
1046
1086
|
- 👥 **Control squad members** with real-time stat updates
|
|
1047
1087
|
- 💬 **Complete communication system** - Private messages, squad wall, alerts
|
|
1088
|
+
- 📅 **Advanced events system** - Daily tasks, squad events, milestones
|
|
1089
|
+
- 👤 **Account management** - Import, link, migrate across platforms
|
|
1090
|
+
- 🏷️ **Alias/dogtags system** - Player ID conversion and search
|
|
1091
|
+
- ⚙️ **Game configuration** - Assets, catalogs, service URLs
|
|
1048
1092
|
- 🎯 **Customize everything** with kill signatures and rich formatting
|
|
1049
1093
|
- 📊 **Track performance** with detailed analytics
|
|
1050
1094
|
- 🎮 **Automate gameplay** with custom bots and scripts
|
|
1051
1095
|
- 🏆 **Create leaderboards** and ranking systems
|
|
1052
1096
|
- 🔄 **Schedule tasks** and monitor activity
|
|
1053
|
-
- 📱 **Manage messages** with inbox and reply systems
|
|
1054
|
-
|
|
1055
1097
|
|
|
1056
1098
|
**Perfect for:**
|
|
1057
1099
|
- 🏆 Squad leaders who want to automate management
|
|
@@ -1062,6 +1104,8 @@ This is the **most comprehensive Modern Combat 5 API library** ever created! Wit
|
|
|
1062
1104
|
- 🏅 Competitive players seeking advantages
|
|
1063
1105
|
- 💬 Community managers handling communications
|
|
1064
1106
|
- 📧 Support teams providing assistance
|
|
1107
|
+
- 📅 Event coordinators managing tournaments
|
|
1108
|
+
- 🏷️ Player search and identification systems
|
|
1065
1109
|
|
|
1066
1110
|
**Ready to dominate Modern Combat 5?** 🚀
|
|
1067
1111
|
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# ────────────[ CHIZOBA ]────────────────────────────
|
|
3
|
+
# | Email : chizoba2026@hotmail.com
|
|
4
|
+
# | File : advanced_features.py
|
|
5
|
+
# | License : MIT License © 2026 Chizoba
|
|
6
|
+
# | Brief : Advanced MC5 API features demonstration
|
|
7
|
+
# ────────────────★─────────────────────────────────
|
|
8
|
+
|
|
9
|
+
"""
|
|
10
|
+
Advanced MC5 API Features Demonstration
|
|
11
|
+
This script showcases the new advanced features:
|
|
12
|
+
- Events API (daily tasks, squad events, milestones)
|
|
13
|
+
- Account Management (import, link, migrate)
|
|
14
|
+
- Alias/Dogtags System (player ID conversion)
|
|
15
|
+
- Game Configuration (assets, catalogs, URLs)
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
import time
|
|
19
|
+
from datetime import datetime
|
|
20
|
+
from mc5_api_client import MC5Client
|
|
21
|
+
from mc5_api_client.exceptions import MC5APIError
|
|
22
|
+
|
|
23
|
+
def main():
|
|
24
|
+
"""Main demonstration of advanced MC5 API features."""
|
|
25
|
+
|
|
26
|
+
print("🚀 MC5 API Advanced Features Demonstration")
|
|
27
|
+
print("=" * 60)
|
|
28
|
+
|
|
29
|
+
# Initialize client with your credentials
|
|
30
|
+
try:
|
|
31
|
+
client = MC5Client(
|
|
32
|
+
username="YOUR_USERNAME_HERE",
|
|
33
|
+
password="YOUR_PASSWORD_HERE"
|
|
34
|
+
)
|
|
35
|
+
print("✅ Successfully connected to MC5 API!")
|
|
36
|
+
|
|
37
|
+
except Exception as e:
|
|
38
|
+
print(f"❌ Failed to connect: {e}")
|
|
39
|
+
return
|
|
40
|
+
|
|
41
|
+
# 1. Events API Demonstration
|
|
42
|
+
print("\n📅 Events API Demonstration")
|
|
43
|
+
print("-" * 40)
|
|
44
|
+
|
|
45
|
+
try:
|
|
46
|
+
# Get all events
|
|
47
|
+
events = client.get_events()
|
|
48
|
+
print(f"📊 Found {len(events)} active events")
|
|
49
|
+
|
|
50
|
+
# Get daily tasks
|
|
51
|
+
daily_tasks = client.get_daily_tasks()
|
|
52
|
+
if daily_tasks:
|
|
53
|
+
print(f"🎯 Daily Tasks Event: {daily_tasks.get('name', 'Unknown')}")
|
|
54
|
+
print(f"📝 Tasks: {len(daily_tasks.get('tasks', []))}")
|
|
55
|
+
print(f"🏆 Milestones: {len(daily_tasks.get('milestones', []))}")
|
|
56
|
+
|
|
57
|
+
# Show first few tasks
|
|
58
|
+
for i, task in enumerate(daily_tasks.get('tasks', [])[:3], 1):
|
|
59
|
+
print(f" {i}. {task.get('condition_type', 'unknown')} - {task.get('points', 0)} points")
|
|
60
|
+
|
|
61
|
+
# Get squad events
|
|
62
|
+
squad_events = client.get_squad_events()
|
|
63
|
+
print(f"👥 Squad Events: {len(squad_events)}")
|
|
64
|
+
|
|
65
|
+
for event in squad_events[:2]: # Show first 2 squad events
|
|
66
|
+
print(f" 🎮 {event.get('name', 'Unknown')}")
|
|
67
|
+
print(f" 📅 Status: {event.get('status', 'unknown')}")
|
|
68
|
+
if event.get('tournament_info'):
|
|
69
|
+
print(f" 🏆 Tournament: {event.get('tournament_info', {}).get('type', 'unknown')}")
|
|
70
|
+
|
|
71
|
+
# Calculate rewards for an event
|
|
72
|
+
if daily_tasks:
|
|
73
|
+
rewards = client.calculate_event_rewards(daily_tasks.get('name', ''), 50)
|
|
74
|
+
print(f"💰 Rewards at 50 points: {len(rewards.get('available_milestones', []))} milestones")
|
|
75
|
+
|
|
76
|
+
except Exception as e:
|
|
77
|
+
print(f"❌ Events API error: {e}")
|
|
78
|
+
|
|
79
|
+
# 2. Account Management Demonstration
|
|
80
|
+
print("\n👤 Account Management Demonstration")
|
|
81
|
+
print("-" * 40)
|
|
82
|
+
|
|
83
|
+
try:
|
|
84
|
+
# Get account info
|
|
85
|
+
account_info = client.get_account_info()
|
|
86
|
+
print(f"📊 Account Name: {account_info.get('name', 'Unknown')}")
|
|
87
|
+
print(f"🎮 Level: {account_info.get('level', 'Unknown')}")
|
|
88
|
+
print(f"💰 Credits: {account_info.get('credits', 'Unknown')}")
|
|
89
|
+
|
|
90
|
+
# Demonstrate account linking (placeholder)
|
|
91
|
+
print("🔗 Account Linking:")
|
|
92
|
+
print(" ✅ Link account functionality available")
|
|
93
|
+
print(" ✅ Account migration functionality available")
|
|
94
|
+
print(" ✅ Account unlink functionality available")
|
|
95
|
+
|
|
96
|
+
# Note: Actual linking would require real credentials and secrets
|
|
97
|
+
print(" ⚠️ Actual linking requires valid platform credentials")
|
|
98
|
+
|
|
99
|
+
except Exception as e:
|
|
100
|
+
print(f"❌ Account management error: {e}")
|
|
101
|
+
|
|
102
|
+
# 3. Alias/Dogtags System Demonstration
|
|
103
|
+
print("\n🏷️ Alias/Dogtags System Demonstration")
|
|
104
|
+
print("-" * 40)
|
|
105
|
+
|
|
106
|
+
try:
|
|
107
|
+
# Demonstrate dogtag to alias conversion
|
|
108
|
+
test_dogtags = ["f55f", "ff11", "g6765", "1234", "abcd"]
|
|
109
|
+
|
|
110
|
+
print("🔄 Dogtag to Alias Conversion:")
|
|
111
|
+
for dogtag in test_dogtags:
|
|
112
|
+
alias = client.convert_dogtag_to_alias(dogtag)
|
|
113
|
+
print(f" {dogtag} → {alias}")
|
|
114
|
+
|
|
115
|
+
print("\n🔄 Alias to Dogtag Conversion:")
|
|
116
|
+
for dogtag in test_dogtags:
|
|
117
|
+
alias = client.convert_dogtag_to_alias(dogtag)
|
|
118
|
+
back_to_dogtag = client.convert_alias_to_dogtag(alias)
|
|
119
|
+
print(f" {alias} → {back_to_dogtag}")
|
|
120
|
+
|
|
121
|
+
# Test alias lookup (with a common alias)
|
|
122
|
+
test_alias = "d33d" # Common test alias
|
|
123
|
+
print(f"\n🔍 Looking up alias: {test_alias}")
|
|
124
|
+
|
|
125
|
+
try:
|
|
126
|
+
alias_info = client.get_alias_info(test_alias)
|
|
127
|
+
print(f" 📊 Type: {alias_info.get('type', 'Unknown')}")
|
|
128
|
+
print(f" 🆔 Account: {alias_info.get('account', 'Unknown')}")
|
|
129
|
+
print(f" 👤 Credential: {alias_info.get('credential', 'Unknown')[:20]}...")
|
|
130
|
+
except Exception as e:
|
|
131
|
+
print(f" ⚠️ Alias lookup failed: {e}")
|
|
132
|
+
|
|
133
|
+
except Exception as e:
|
|
134
|
+
print(f"❌ Alias system error: {e}")
|
|
135
|
+
|
|
136
|
+
# 4. Game Configuration Demonstration
|
|
137
|
+
print("\n⚙️ Game Configuration Demonstration")
|
|
138
|
+
print("-" * 40)
|
|
139
|
+
|
|
140
|
+
try:
|
|
141
|
+
# Get service URLs
|
|
142
|
+
service_urls = client.get_service_urls()
|
|
143
|
+
print("🌐 Service URLs:")
|
|
144
|
+
for service, url in service_urls.items():
|
|
145
|
+
print(f" {service}: {url}")
|
|
146
|
+
|
|
147
|
+
# Get basic game config
|
|
148
|
+
basic_config = client.get_game_config("basic")
|
|
149
|
+
print(f"\n📊 Basic Config:")
|
|
150
|
+
print(f" 🆔 Client ID: {basic_config.get('client_id', 'Unknown')}")
|
|
151
|
+
print(f" 🌐 Services: {len(basic_config.get('service_urls', {}))}")
|
|
152
|
+
|
|
153
|
+
# Get asset metadata (example)
|
|
154
|
+
asset_path = "videos_HD_UPD18_pvx"
|
|
155
|
+
print(f"\n📹 Asset Metadata for: {asset_path}")
|
|
156
|
+
|
|
157
|
+
try:
|
|
158
|
+
asset_metadata = client.get_asset_metadata(asset_path)
|
|
159
|
+
print(f" 🔑 Hash: {asset_metadata.get('hash', 'Unknown')}")
|
|
160
|
+
except Exception as e:
|
|
161
|
+
print(f" ⚠️ Asset metadata not available: {e}")
|
|
162
|
+
|
|
163
|
+
# Get game object catalog
|
|
164
|
+
print(f"\n📦 Game Object Catalog:")
|
|
165
|
+
try:
|
|
166
|
+
game_objects = client.get_game_object_catalog()
|
|
167
|
+
print(f" 📊 Total Objects: {len(game_objects)}")
|
|
168
|
+
|
|
169
|
+
# Show first few object types
|
|
170
|
+
object_types = set()
|
|
171
|
+
for obj in game_objects[:10]: # First 10 objects
|
|
172
|
+
object_types.add(obj.get('category', 'unknown'))
|
|
173
|
+
|
|
174
|
+
print(f" 🏷️ Object Types: {', '.join(list(object_types)[:5])}")
|
|
175
|
+
|
|
176
|
+
except Exception as e:
|
|
177
|
+
print(f" ⚠️ Game object catalog not available: {e}")
|
|
178
|
+
|
|
179
|
+
except Exception as e:
|
|
180
|
+
print(f"❌ Game configuration error: {e}")
|
|
181
|
+
|
|
182
|
+
# 5. Advanced Usage Examples
|
|
183
|
+
print("\n🎯 Advanced Usage Examples")
|
|
184
|
+
print("-" * 40)
|
|
185
|
+
|
|
186
|
+
try:
|
|
187
|
+
# Example 1: Event Progress Tracker
|
|
188
|
+
print("📈 Event Progress Tracker:")
|
|
189
|
+
if daily_tasks:
|
|
190
|
+
current_points = 75 # Simulated current points
|
|
191
|
+
rewards = client.calculate_event_rewards(daily_tasks.get('name', ''), current_points)
|
|
192
|
+
|
|
193
|
+
print(f" 📊 Current Points: {current_points}")
|
|
194
|
+
print(f" 🏆 Available Milestones: {len(rewards.get('available_milestones', []))}")
|
|
195
|
+
|
|
196
|
+
next_milestone = rewards.get('next_milestone', {})
|
|
197
|
+
if next_milestone:
|
|
198
|
+
needed = next_milestone.get('condition', 0) - current_points
|
|
199
|
+
print(f" 🎯 Next Milestone: {needed} points needed")
|
|
200
|
+
|
|
201
|
+
# Example 2: Player Search System
|
|
202
|
+
print("\n🔍 Player Search System:")
|
|
203
|
+
test_aliases = ["d33d", "e44e", "f55f"] # Test aliases
|
|
204
|
+
|
|
205
|
+
for alias in test_aliases:
|
|
206
|
+
try:
|
|
207
|
+
player_info = client.search_player_by_alias(alias)
|
|
208
|
+
if player_info.get('account'):
|
|
209
|
+
print(f" ✅ Found player: {player_info.get('account', 'Unknown')}")
|
|
210
|
+
else:
|
|
211
|
+
print(f" ❌ Player not found: {alias}")
|
|
212
|
+
except:
|
|
213
|
+
print(f" ⚠️ Could not search: {alias}")
|
|
214
|
+
|
|
215
|
+
# Example 3: Configuration Monitor
|
|
216
|
+
print("\n🔧 Configuration Monitor:")
|
|
217
|
+
config = client.get_game_config("all")
|
|
218
|
+
print(f" 🌐 Active Services: {len(config.get('service_urls', {}))}")
|
|
219
|
+
print(f" 📦 Game Objects: {'Available' if config.get('game_objects') else 'Not Available'}")
|
|
220
|
+
print(f" 📹 Asset Metadata: {config.get('asset_metadata', 'Not Available')}")
|
|
221
|
+
|
|
222
|
+
except Exception as e:
|
|
223
|
+
print(f"❌ Advanced usage error: {e}")
|
|
224
|
+
|
|
225
|
+
# 6. Performance Tips
|
|
226
|
+
print("\n💡 Performance Tips")
|
|
227
|
+
print("-" * 40)
|
|
228
|
+
print("🚀 Use context managers for automatic cleanup:")
|
|
229
|
+
print(" with MC5Client(username, password) as client:")
|
|
230
|
+
print(" # Your code here")
|
|
231
|
+
print(" # Automatically closes connection")
|
|
232
|
+
print()
|
|
233
|
+
print("📊 Cache event data to avoid repeated API calls:")
|
|
234
|
+
print(" events = client.get_events() # Call once")
|
|
235
|
+
print(" # Use cached events_data for operations")
|
|
236
|
+
print()
|
|
237
|
+
print("🔄 Use batch operations where possible:")
|
|
238
|
+
print(" # Process multiple aliases in one loop")
|
|
239
|
+
print(" # Calculate rewards for multiple events")
|
|
240
|
+
print()
|
|
241
|
+
print("⚡ Handle errors gracefully:")
|
|
242
|
+
print(" try:")
|
|
243
|
+
print(" result = client.get_events()")
|
|
244
|
+
print(" except MC5APIError as e:")
|
|
245
|
+
print(" print(f\"API Error: {e}\")")
|
|
246
|
+
print(" # Fallback handling")
|
|
247
|
+
|
|
248
|
+
# Clean up
|
|
249
|
+
print("\n🧹 Cleaning up...")
|
|
250
|
+
try:
|
|
251
|
+
client.close()
|
|
252
|
+
print("✅ Connection closed successfully!")
|
|
253
|
+
|
|
254
|
+
except Exception as e:
|
|
255
|
+
print(f"⚠️ Error during cleanup: {e}")
|
|
256
|
+
|
|
257
|
+
print("\n🎉 Advanced Features Demonstration Complete!")
|
|
258
|
+
print("\n📚 What You Learned:")
|
|
259
|
+
print(" 📅 Events API - Daily tasks, squad events, milestones")
|
|
260
|
+
print(" 👤 Account Management - Import, link, migrate accounts")
|
|
261
|
+
print(" 🏷️ Alias System - Convert dogtags, search players")
|
|
262
|
+
print(" ⚙️ Game Config - Assets, catalogs, service URLs")
|
|
263
|
+
print(" 🎯 Advanced Usage - Progress tracking, search, monitoring")
|
|
264
|
+
print(" 💡 Performance Tips - Best practices for efficient usage")
|
|
265
|
+
|
|
266
|
+
print("\n🎮 Ready to build advanced MC5 applications!")
|
|
267
|
+
|
|
268
|
+
if __name__ == "__main__":
|
|
269
|
+
main()
|
|
@@ -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.3"
|
|
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.3",
|
|
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",
|