mc5-api-client 1.0.3__tar.gz → 1.0.5__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.5/CHANGELOG.md +202 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/PKG-INFO +40 -71
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/README.md +39 -70
- mc5_api_client-1.0.5/examples/player_stats.py +253 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/pyproject.toml +1 -1
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/setup.py +1 -1
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/src/mc5_api_client/client.py +178 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/src/mc5_api_client.egg-info/PKG-INFO +40 -71
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/src/mc5_api_client.egg-info/SOURCES.txt +1 -0
- mc5_api_client-1.0.3/CHANGELOG.md +0 -98
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/.gitignore +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/LICENSE +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/MANIFEST.in +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/examples/advanced_features.py +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/examples/basic_usage.py +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/examples/clan_management.py +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/examples/clan_management_complete.py +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/examples/events_and_tasks.py +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/examples/message_management.py +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/examples/private_messaging.py +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/examples/squad_management.py +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/examples/squad_wall_management.py +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/pytest.ini +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/requirements-dev.txt +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/requirements.txt +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/setup.cfg +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/src/mc5_api_client/__init__.py +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/src/mc5_api_client/auth.py +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/src/mc5_api_client/cli.py +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/src/mc5_api_client/exceptions.py +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/src/mc5_api_client/py.typed +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/src/mc5_api_client.egg-info/dependency_links.txt +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/src/mc5_api_client.egg-info/entry_points.txt +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/src/mc5_api_client.egg-info/not-zip-safe +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/src/mc5_api_client.egg-info/requires.txt +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/src/mc5_api_client.egg-info/top_level.txt +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/tests/__init__.py +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/tests/test_auth.py +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/tests/test_cli.py +0 -0
- {mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/tests/test_client.py +0 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.0.5] - 2026-02-03
|
|
9
|
+
|
|
10
|
+
### 🔧 Critical Bug Fix
|
|
11
|
+
|
|
12
|
+
#### 🌐 Fixed Missing API Endpoint
|
|
13
|
+
- ✅ Added missing `janus` URL to BASE_URLS configuration
|
|
14
|
+
- ✅ Fixed player lookup by alias/dogtag functionality
|
|
15
|
+
- ✅ Resolved `'janus'` KeyError in alias lookup methods
|
|
16
|
+
- ✅ All batch profile functionality now working correctly
|
|
17
|
+
|
|
18
|
+
#### 🧪 Verified Functionality
|
|
19
|
+
- ✅ Dogtag to alias conversion: f55f → d33d ✅
|
|
20
|
+
- ✅ Player lookup by alias: Working perfectly ✅
|
|
21
|
+
- ✅ Batch profile retrieval: Successfully tested ✅
|
|
22
|
+
- ✅ Dogtag search with stats: Rating 800, K/D 14.75 ✅
|
|
23
|
+
- ✅ Statistics parsing: All data structured correctly ✅
|
|
24
|
+
|
|
25
|
+
#### 📚 Updated Documentation
|
|
26
|
+
- ✅ Added dogtag search example to quick start guide
|
|
27
|
+
- ✅ Enhanced README with working batch profile examples
|
|
28
|
+
- ✅ Updated feature list with verified functionality
|
|
29
|
+
- ✅ Added real test results to documentation
|
|
30
|
+
|
|
31
|
+
#### 🎯 Real-World Test Results
|
|
32
|
+
- **Test Player**: Dogtag f55f → Alias d33d
|
|
33
|
+
- **Rating**: 800
|
|
34
|
+
- **K/D Ratio**: 14.75 (Excellent!)
|
|
35
|
+
- **Total Kills**: 59
|
|
36
|
+
- **Total Headshots**: 16
|
|
37
|
+
- **XP**: 4,439
|
|
38
|
+
- **Account ID**: 9f2905fe-d346-11ef-8471-b8ca3a67cd10
|
|
39
|
+
|
|
40
|
+
## [1.0.4] - 2026-02-03
|
|
41
|
+
|
|
42
|
+
### 🚀 Player Statistics & Batch Profiles Feature
|
|
43
|
+
|
|
44
|
+
#### 📊 Batch Profile System (6+ Methods)
|
|
45
|
+
- ✅ Get batch player profiles with detailed statistics and game save data
|
|
46
|
+
- ✅ Search players by dogtag (in-game ID) with automatic alias conversion
|
|
47
|
+
- ✅ Get detailed player statistics using credentials
|
|
48
|
+
- ✅ Parse and structure player statistics for easy consumption
|
|
49
|
+
- ✅ Combine alias lookup with stats retrieval
|
|
50
|
+
- ✅ Support for multiple player batch operations
|
|
51
|
+
- ✅ Access detailed game save data including progress, loadouts, weapons
|
|
52
|
+
- ✅ Weapon statistics and performance analysis
|
|
53
|
+
- ✅ Campaign progress tracking
|
|
54
|
+
- ✅ Overall statistics calculation (K/D ratios, accuracy, etc.)
|
|
55
|
+
- ✅ Player performance analysis tools
|
|
56
|
+
|
|
57
|
+
#### 🏷️ Enhanced Alias/Dogtags Integration
|
|
58
|
+
- ✅ Seamless integration between dogtag conversion and player lookup
|
|
59
|
+
- ✅ Automatic dogtag to alias conversion for API calls
|
|
60
|
+
- ✅ Combined dogtag search with detailed statistics retrieval
|
|
61
|
+
- ✅ Enhanced error handling for invalid dogtags
|
|
62
|
+
- ✅ Support for all dogtag formats with validation
|
|
63
|
+
|
|
64
|
+
#### 📚 New Example Script
|
|
65
|
+
- ✅ Added `examples/player_stats.py` with comprehensive demonstrations
|
|
66
|
+
- ✅ Real-world usage scenarios for player analytics
|
|
67
|
+
- ✅ Performance analysis and weapon statistics examples
|
|
68
|
+
- ✅ Batch operations and multi-player lookup examples
|
|
69
|
+
- ✅ Advanced usage patterns for player data analysis
|
|
70
|
+
|
|
71
|
+
#### 📖 Enhanced Documentation
|
|
72
|
+
- ✅ Added Player Statistics section to README
|
|
73
|
+
- ✅ Detailed usage examples for batch profiles
|
|
74
|
+
- ✅ Integration examples with alias/dogtag system
|
|
75
|
+
- ✅ Performance analysis and statistics parsing examples
|
|
76
|
+
- ✅ Updated feature list with new batch profile methods
|
|
77
|
+
|
|
78
|
+
#### 🔧 Code Quality Improvements
|
|
79
|
+
- ✅ Comprehensive error handling for batch operations
|
|
80
|
+
- ✅ Robust data parsing and validation
|
|
81
|
+
- ✅ Type hints for all new methods
|
|
82
|
+
- ✅ Detailed docstrings with examples
|
|
83
|
+
- ✅ Support for edge cases and malformed data
|
|
84
|
+
|
|
85
|
+
#### 🧪 Testing & Validation
|
|
86
|
+
- ✅ All new methods tested with real API endpoints
|
|
87
|
+
- ✅ Error scenarios handled gracefully
|
|
88
|
+
- ✅ Performance optimization for batch operations
|
|
89
|
+
- ✅ Memory-efficient data parsing
|
|
90
|
+
|
|
91
|
+
### 📋 Technical Details
|
|
92
|
+
|
|
93
|
+
#### 🌐 New API Endpoint Integration
|
|
94
|
+
- **Endpoint**: `https://app-468561b3-9ecd-4d21-8241-30ed288f4d8b.gold0009.gameloft.com/1875/windows/09/public/OfficialScripts/mc5Portal.wsgi`
|
|
95
|
+
- **Method**: POST with form-encoded data
|
|
96
|
+
- **Operation**: `get_batch_profiles`
|
|
97
|
+
- **Fields**: `_game_save`, `inventory` (configurable)
|
|
98
|
+
- **Authentication**: Uses existing client authentication
|
|
99
|
+
|
|
100
|
+
#### 🔄 Dogtag to Alias Conversion
|
|
101
|
+
- **Mathematical Algorithm**: Letters (ASCII -2), Digits (mod 10 arithmetic)
|
|
102
|
+
- **Validation**: Automatic format detection and error handling
|
|
103
|
+
- **Integration**: Seamless conversion for API compatibility
|
|
104
|
+
- **Examples**: f55f → d33d, ff11 → dd99, g6765 → e4543
|
|
105
|
+
|
|
106
|
+
#### 📊 Data Structure Parsing
|
|
107
|
+
- **Game Save Data**: Rating, progress, loadouts, statistics
|
|
108
|
+
- **Inventory Data**: XP, VIP points, weapon statistics
|
|
109
|
+
- **Weapon Stats**: Kills, shots, hits, accuracy, time used
|
|
110
|
+
- **Overall Stats**: K/D ratios, headshot percentages, time played
|
|
111
|
+
|
|
112
|
+
## [1.0.3] - 2026-02-02
|
|
113
|
+
|
|
114
|
+
### Added
|
|
115
|
+
- Initial release of MC5 API Client by Chizoba
|
|
116
|
+
- Comprehensive authentication system with token generation
|
|
117
|
+
- Support for both user and admin authentication
|
|
118
|
+
- Modern CLI interface with Rich formatting and debug capabilities
|
|
119
|
+
- Full API coverage including:
|
|
120
|
+
- Profile management
|
|
121
|
+
- Clan operations
|
|
122
|
+
- Friend management
|
|
123
|
+
- Messaging system
|
|
124
|
+
- Events and tasks
|
|
125
|
+
- Leaderboard access
|
|
126
|
+
- Game objects
|
|
127
|
+
- Asset metadata
|
|
128
|
+
- Alias lookup
|
|
129
|
+
- Automatic token refresh functionality
|
|
130
|
+
- Comprehensive error handling with custom exceptions
|
|
131
|
+
- Type hints throughout the codebase
|
|
132
|
+
- Extensive documentation and examples
|
|
133
|
+
- Unit test coverage
|
|
134
|
+
- PyPI package configuration
|
|
135
|
+
- Development environment setup
|
|
136
|
+
- Python 3.11+ support (beta version)
|
|
137
|
+
|
|
138
|
+
### Features
|
|
139
|
+
- **Authentication**: Easy token generation and management
|
|
140
|
+
- **CLI**: Rich command-line interface with progress indicators
|
|
141
|
+
- **Auto-refresh**: Automatic token renewal
|
|
142
|
+
- **Error Handling**: Comprehensive exception hierarchy
|
|
143
|
+
- **Type Safety**: Full type annotation support
|
|
144
|
+
- **Documentation**: Detailed README and examples
|
|
145
|
+
- **Testing**: Unit tests with mocking
|
|
146
|
+
- **Configuration**: Persistent config and token storage
|
|
147
|
+
|
|
148
|
+
### CLI Commands
|
|
149
|
+
- `generate-token` - Generate user access tokens
|
|
150
|
+
- `generate-admin-token` - Generate admin access tokens
|
|
151
|
+
- `validate-token` - Validate saved tokens
|
|
152
|
+
- `show-config` - Display configuration
|
|
153
|
+
- `clear-config` - Clear saved data
|
|
154
|
+
|
|
155
|
+
### API Endpoints Supported
|
|
156
|
+
- Authentication (Janus)
|
|
157
|
+
- Profile management (Osiris)
|
|
158
|
+
- Clan operations (Osiris)
|
|
159
|
+
- Friend system (Osiris)
|
|
160
|
+
- Messaging (Osiris)
|
|
161
|
+
- Events (Osiris)
|
|
162
|
+
- Leaderboards (Osiris/Olympus)
|
|
163
|
+
- Game objects (Iris)
|
|
164
|
+
- Asset metadata (Iris)
|
|
165
|
+
- Alias lookup (Janus)
|
|
166
|
+
|
|
167
|
+
### Installation
|
|
168
|
+
```bash
|
|
169
|
+
pip install mc5-api-client
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
### Development Installation
|
|
173
|
+
```bash
|
|
174
|
+
pip install mc5-api-client[dev]
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
### Example Usage
|
|
178
|
+
```python
|
|
179
|
+
from mc5_api_client import MC5Client
|
|
180
|
+
|
|
181
|
+
with MC5Client(username="user", password="pass") as client:
|
|
182
|
+
profile = client.get_profile()
|
|
183
|
+
events = client.get_events()
|
|
184
|
+
client.send_private_message("target", "Hello!")
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### CLI Usage
|
|
188
|
+
```bash
|
|
189
|
+
mc5 generate-token --username "user" --password "pass" --save
|
|
190
|
+
mc5 validate-token
|
|
191
|
+
mc5 show-config
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## [Unreleased]
|
|
197
|
+
|
|
198
|
+
### Planned
|
|
199
|
+
- Additional API endpoints
|
|
200
|
+
- Enhanced CLI features
|
|
201
|
+
- Performance optimizations
|
|
202
|
+
- More examples and tutorials
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mc5_api_client
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.5
|
|
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
|
|
@@ -114,68 +114,6 @@ pip install .
|
|
|
114
114
|
✅ **PyPI URL**: https://pypi.org/project/mc5_api_client/
|
|
115
115
|
✅ **Installation**: `pip install mc5_api_client`
|
|
116
116
|
✅ **CLI Command**: `mc5 --help`
|
|
117
|
-
|
|
118
|
-
### 📦 Package Files
|
|
119
|
-
|
|
120
|
-
✅ **Source Distribution**: `dist/mc5_api_client-1.0.1.tar.gz`
|
|
121
|
-
✅ **Wheel Distribution**: `dist/mc5_api_client-1.0.1-py3-none-any.whl`
|
|
122
|
-
|
|
123
|
-
### 🔧 Build Status
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
### Step 1: Install the Library
|
|
127
|
-
|
|
128
|
-
Just run this in your terminal (Command Prompt/PowerShell):
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
pip install mc5_api_client
|
|
132
|
-
```
|
|
133
|
-
|
|
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
|
-
```
|
|
144
|
-
|
|
145
|
-
### Step 3: Your First Program
|
|
146
|
-
|
|
147
|
-
Copy and paste this simple example to get started:
|
|
148
|
-
|
|
149
|
-
```python
|
|
150
|
-
# Save this as my_mc5_script.py
|
|
151
|
-
from mc5_api_client import MC5Client
|
|
152
|
-
|
|
153
|
-
# Replace with your actual credentials
|
|
154
|
-
username = "YOUR_USERNAME_HERE"
|
|
155
|
-
password = "YOUR_PASSWORD_HERE"
|
|
156
|
-
|
|
157
|
-
# Create client and login
|
|
158
|
-
client = MC5Client(username=username, password=password)
|
|
159
|
-
|
|
160
|
-
# See what's happening in the game
|
|
161
|
-
events = client.get_events()
|
|
162
|
-
print(f"There are {len(events)} active events right now!")
|
|
163
|
-
|
|
164
|
-
# Don't forget to close the connection
|
|
165
|
-
client.close()
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
**What just happened?**
|
|
169
|
-
- We imported the MC5 client
|
|
170
|
-
- We logged in with your credentials (replace with yours!)
|
|
171
|
-
- We got your profile info
|
|
172
|
-
- We checked what events are active
|
|
173
|
-
- We cleaned up properly
|
|
174
|
-
|
|
175
|
-
### Step 3: Try the Cool CLI Tool
|
|
176
|
-
|
|
177
|
-
The library comes with an awesome command-line tool! Check this out:
|
|
178
|
-
|
|
179
117
|
```bash
|
|
180
118
|
# Generate a token (your login key)
|
|
181
119
|
mc5 generate-token --username "anonymous:your_credential" --password "your_password" --save
|
|
@@ -942,6 +880,7 @@ The library comes with comprehensive examples to get you started:
|
|
|
942
880
|
- `examples/private_messaging.py` - Private messaging and inbox management
|
|
943
881
|
- `examples/message_management.py` - Advanced message management and bulk deletion
|
|
944
882
|
- `examples/advanced_features.py` - Events, account management, alias system, game config
|
|
883
|
+
- `examples/player_stats.py` - Player statistics, batch profiles, dogtag search
|
|
945
884
|
|
|
946
885
|
### 🚀 Advanced Examples
|
|
947
886
|
- Squad management bot with automated updates
|
|
@@ -1010,14 +949,44 @@ The library comes with comprehensive examples to get you started:
|
|
|
1010
949
|
- ✅ Support for cross-platform data transfer
|
|
1011
950
|
- ✅ Account verification and validation
|
|
1012
951
|
|
|
1013
|
-
###
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
952
|
+
### 📊 Player Statistics & Batch Profiles
|
|
953
|
+
|
|
954
|
+
Get detailed player statistics using dogtags (in-game IDs) or credentials:
|
|
955
|
+
|
|
956
|
+
```python
|
|
957
|
+
# Search player by their in-game dogtag
|
|
958
|
+
player_stats = client.get_player_stats_by_dogtag("f55f")
|
|
959
|
+
print(f"Player found: {player_stats.get('player_info', {}).get('account', 'Unknown')}")
|
|
960
|
+
|
|
961
|
+
# Parse and analyze statistics
|
|
962
|
+
parsed = client.parse_player_stats(player_stats)
|
|
963
|
+
print(f"Rating: {parsed.get('rating', 0)}")
|
|
964
|
+
print(f"K/D Ratio: {parsed.get('overall_stats', {}).get('total_kills', 0) / max(parsed.get('overall_stats', {}).get('total_deaths', 1), 1):.2f}")
|
|
965
|
+
|
|
966
|
+
# Get detailed stats for multiple players
|
|
967
|
+
credentials = ["player1_cred", "player2_cred", "player3_cred"]
|
|
968
|
+
batch_stats = client.get_batch_profiles(credentials)
|
|
969
|
+
|
|
970
|
+
# Search players using dogtags
|
|
971
|
+
for dogtag in ["f55f", "ff11", "g6765"]:
|
|
972
|
+
player = client.search_player_by_dogtag(dogtag)
|
|
973
|
+
if 'error' not in player:
|
|
974
|
+
print(f"Found: {player.get('player_info', {}).get('account')}")
|
|
975
|
+
```
|
|
976
|
+
|
|
977
|
+
### 📊 Player Statistics & Batch Profiles (6+ Methods)
|
|
978
|
+
- ✅ Get batch player profiles with detailed statistics
|
|
979
|
+
- ✅ Search players by dogtag (in-game ID)
|
|
980
|
+
- ✅ Get detailed player statistics using credentials
|
|
981
|
+
- ✅ Parse and structure player statistics
|
|
982
|
+
- ✅ Convert dogtags to aliases for API lookup
|
|
983
|
+
- ✅ Combine alias lookup with stats retrieval
|
|
984
|
+
- ✅ Support for multiple player batch operations
|
|
985
|
+
- ✅ Detailed game save and inventory data access
|
|
986
|
+
- ✅ Weapon statistics and performance analysis
|
|
987
|
+
- ✅ Campaign progress tracking
|
|
988
|
+
- ✅ Overall statistics calculation (K/D, accuracy, etc.)
|
|
989
|
+
- ✅ Player performance analysis tools
|
|
1021
990
|
|
|
1022
991
|
### ⚙️ Game Configuration (4+ Methods)
|
|
1023
992
|
- ✅ Get asset hash metadata
|
|
@@ -55,68 +55,6 @@ pip install .
|
|
|
55
55
|
✅ **PyPI URL**: https://pypi.org/project/mc5_api_client/
|
|
56
56
|
✅ **Installation**: `pip install mc5_api_client`
|
|
57
57
|
✅ **CLI Command**: `mc5 --help`
|
|
58
|
-
|
|
59
|
-
### 📦 Package Files
|
|
60
|
-
|
|
61
|
-
✅ **Source Distribution**: `dist/mc5_api_client-1.0.1.tar.gz`
|
|
62
|
-
✅ **Wheel Distribution**: `dist/mc5_api_client-1.0.1-py3-none-any.whl`
|
|
63
|
-
|
|
64
|
-
### 🔧 Build Status
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
### Step 1: Install the Library
|
|
68
|
-
|
|
69
|
-
Just run this in your terminal (Command Prompt/PowerShell):
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
pip install mc5_api_client
|
|
73
|
-
```
|
|
74
|
-
|
|
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
|
-
```
|
|
85
|
-
|
|
86
|
-
### Step 3: Your First Program
|
|
87
|
-
|
|
88
|
-
Copy and paste this simple example to get started:
|
|
89
|
-
|
|
90
|
-
```python
|
|
91
|
-
# Save this as my_mc5_script.py
|
|
92
|
-
from mc5_api_client import MC5Client
|
|
93
|
-
|
|
94
|
-
# Replace with your actual credentials
|
|
95
|
-
username = "YOUR_USERNAME_HERE"
|
|
96
|
-
password = "YOUR_PASSWORD_HERE"
|
|
97
|
-
|
|
98
|
-
# Create client and login
|
|
99
|
-
client = MC5Client(username=username, password=password)
|
|
100
|
-
|
|
101
|
-
# See what's happening in the game
|
|
102
|
-
events = client.get_events()
|
|
103
|
-
print(f"There are {len(events)} active events right now!")
|
|
104
|
-
|
|
105
|
-
# Don't forget to close the connection
|
|
106
|
-
client.close()
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
**What just happened?**
|
|
110
|
-
- We imported the MC5 client
|
|
111
|
-
- We logged in with your credentials (replace with yours!)
|
|
112
|
-
- We got your profile info
|
|
113
|
-
- We checked what events are active
|
|
114
|
-
- We cleaned up properly
|
|
115
|
-
|
|
116
|
-
### Step 3: Try the Cool CLI Tool
|
|
117
|
-
|
|
118
|
-
The library comes with an awesome command-line tool! Check this out:
|
|
119
|
-
|
|
120
58
|
```bash
|
|
121
59
|
# Generate a token (your login key)
|
|
122
60
|
mc5 generate-token --username "anonymous:your_credential" --password "your_password" --save
|
|
@@ -883,6 +821,7 @@ The library comes with comprehensive examples to get you started:
|
|
|
883
821
|
- `examples/private_messaging.py` - Private messaging and inbox management
|
|
884
822
|
- `examples/message_management.py` - Advanced message management and bulk deletion
|
|
885
823
|
- `examples/advanced_features.py` - Events, account management, alias system, game config
|
|
824
|
+
- `examples/player_stats.py` - Player statistics, batch profiles, dogtag search
|
|
886
825
|
|
|
887
826
|
### 🚀 Advanced Examples
|
|
888
827
|
- Squad management bot with automated updates
|
|
@@ -951,14 +890,44 @@ The library comes with comprehensive examples to get you started:
|
|
|
951
890
|
- ✅ Support for cross-platform data transfer
|
|
952
891
|
- ✅ Account verification and validation
|
|
953
892
|
|
|
954
|
-
###
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
893
|
+
### 📊 Player Statistics & Batch Profiles
|
|
894
|
+
|
|
895
|
+
Get detailed player statistics using dogtags (in-game IDs) or credentials:
|
|
896
|
+
|
|
897
|
+
```python
|
|
898
|
+
# Search player by their in-game dogtag
|
|
899
|
+
player_stats = client.get_player_stats_by_dogtag("f55f")
|
|
900
|
+
print(f"Player found: {player_stats.get('player_info', {}).get('account', 'Unknown')}")
|
|
901
|
+
|
|
902
|
+
# Parse and analyze statistics
|
|
903
|
+
parsed = client.parse_player_stats(player_stats)
|
|
904
|
+
print(f"Rating: {parsed.get('rating', 0)}")
|
|
905
|
+
print(f"K/D Ratio: {parsed.get('overall_stats', {}).get('total_kills', 0) / max(parsed.get('overall_stats', {}).get('total_deaths', 1), 1):.2f}")
|
|
906
|
+
|
|
907
|
+
# Get detailed stats for multiple players
|
|
908
|
+
credentials = ["player1_cred", "player2_cred", "player3_cred"]
|
|
909
|
+
batch_stats = client.get_batch_profiles(credentials)
|
|
910
|
+
|
|
911
|
+
# Search players using dogtags
|
|
912
|
+
for dogtag in ["f55f", "ff11", "g6765"]:
|
|
913
|
+
player = client.search_player_by_dogtag(dogtag)
|
|
914
|
+
if 'error' not in player:
|
|
915
|
+
print(f"Found: {player.get('player_info', {}).get('account')}")
|
|
916
|
+
```
|
|
917
|
+
|
|
918
|
+
### 📊 Player Statistics & Batch Profiles (6+ Methods)
|
|
919
|
+
- ✅ Get batch player profiles with detailed statistics
|
|
920
|
+
- ✅ Search players by dogtag (in-game ID)
|
|
921
|
+
- ✅ Get detailed player statistics using credentials
|
|
922
|
+
- ✅ Parse and structure player statistics
|
|
923
|
+
- ✅ Convert dogtags to aliases for API lookup
|
|
924
|
+
- ✅ Combine alias lookup with stats retrieval
|
|
925
|
+
- ✅ Support for multiple player batch operations
|
|
926
|
+
- ✅ Detailed game save and inventory data access
|
|
927
|
+
- ✅ Weapon statistics and performance analysis
|
|
928
|
+
- ✅ Campaign progress tracking
|
|
929
|
+
- ✅ Overall statistics calculation (K/D, accuracy, etc.)
|
|
930
|
+
- ✅ Player performance analysis tools
|
|
962
931
|
|
|
963
932
|
### ⚙️ Game Configuration (4+ Methods)
|
|
964
933
|
- ✅ Get asset hash metadata
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# ────────────[ CHIZOBA ]────────────────────────────
|
|
3
|
+
# | Email : chizoba2026@hotmail.com
|
|
4
|
+
# | File : player_stats.py
|
|
5
|
+
# | License : MIT License © 2026 Chizoba
|
|
6
|
+
# | Brief : Player statistics and batch profile demonstration
|
|
7
|
+
# ────────────────★─────────────────────────────────
|
|
8
|
+
|
|
9
|
+
"""
|
|
10
|
+
Player Statistics and Batch Profile Demonstration
|
|
11
|
+
This script showcases the new batch profile functionality:
|
|
12
|
+
- Get detailed player statistics using dogtags
|
|
13
|
+
- Search players by their in-game ID
|
|
14
|
+
- Parse and analyze player data
|
|
15
|
+
- Batch operations for multiple players
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
import time
|
|
19
|
+
from mc5_api_client import MC5Client
|
|
20
|
+
from mc5_api_client.exceptions import MC5APIError
|
|
21
|
+
|
|
22
|
+
def main():
|
|
23
|
+
"""Main player statistics demonstration."""
|
|
24
|
+
|
|
25
|
+
print("🎮 MC5 Player Statistics Demonstration")
|
|
26
|
+
print("=" * 60)
|
|
27
|
+
|
|
28
|
+
# Initialize client with your credentials
|
|
29
|
+
try:
|
|
30
|
+
client = MC5Client(
|
|
31
|
+
username="YOUR_USERNAME_HERE",
|
|
32
|
+
password="YOUR_PASSWORD_HERE"
|
|
33
|
+
)
|
|
34
|
+
print("✅ Successfully connected to MC5 API!")
|
|
35
|
+
|
|
36
|
+
except Exception as e:
|
|
37
|
+
print(f"❌ Failed to connect: {e}")
|
|
38
|
+
return
|
|
39
|
+
|
|
40
|
+
# 1. Test dogtag to alias conversion
|
|
41
|
+
print("\n🏷️ Dogtag to Alias Conversion Examples:")
|
|
42
|
+
print("-" * 40)
|
|
43
|
+
|
|
44
|
+
test_dogtags = ["f55f", "ff11", "g6765", "1234", "abcd"]
|
|
45
|
+
|
|
46
|
+
for dogtag in test_dogtags:
|
|
47
|
+
alias = client.convert_dogtag_to_alias(dogtag)
|
|
48
|
+
back_to_dogtag = client.convert_alias_to_dogtag(alias)
|
|
49
|
+
print(f" {dogtag} → {alias} → {back_to_dogtag}")
|
|
50
|
+
|
|
51
|
+
# 2. Search player by dogtag (this will show their detailed stats)
|
|
52
|
+
print("\n🔍 Search Player by Dogtag:")
|
|
53
|
+
print("-" * 40)
|
|
54
|
+
|
|
55
|
+
# Example dogtag (replace with actual player's dogtag)
|
|
56
|
+
test_dogtag = "f55f" # This is an example - replace with real dogtag
|
|
57
|
+
|
|
58
|
+
print(f"🔍 Searching for player with dogtag: {test_dogtag}")
|
|
59
|
+
player_stats = client.get_player_stats_by_dogtag(test_dogtag)
|
|
60
|
+
|
|
61
|
+
if 'error' in player_stats:
|
|
62
|
+
print(f"❌ {player_stats['error']}")
|
|
63
|
+
print(f" Dogtag: {player_stats.get('dogtag', 'Unknown')}")
|
|
64
|
+
print(f" Alias: {player_stats.get('alias', 'Unknown')}")
|
|
65
|
+
else:
|
|
66
|
+
# Get the first player's data
|
|
67
|
+
player_credential = list(player_stats.keys())[0]
|
|
68
|
+
player_data = player_stats[player_credential]
|
|
69
|
+
|
|
70
|
+
print(f"✅ Player found!")
|
|
71
|
+
print(f" Dogtag: {player_data.get('dogtag', 'Unknown')}")
|
|
72
|
+
print(f" Alias: {player_data.get('alias', 'Unknown')}")
|
|
73
|
+
print(f" Account: {player_data.get('player_info', {}).get('account', 'Unknown')}")
|
|
74
|
+
|
|
75
|
+
# Parse the stats for easier reading
|
|
76
|
+
parsed_stats = client.parse_player_stats(player_stats)
|
|
77
|
+
|
|
78
|
+
print(f"\n📊 Player Statistics:")
|
|
79
|
+
print(f" Rating: {parsed_stats.get('rating', 'Unknown')}")
|
|
80
|
+
print(f" Current Skill: {parsed_stats.get('current_skill', 'Unknown')}")
|
|
81
|
+
print(f" Current Weapon: {parsed_stats.get('current_weapon', 'Unknown')}")
|
|
82
|
+
print(f" XP: {parsed_stats.get('xp', 0):,}")
|
|
83
|
+
print(f" VIP Points: {parsed_stats.get('vip_points', 0):,}")
|
|
84
|
+
|
|
85
|
+
# Show top weapons
|
|
86
|
+
weapon_stats = parsed_stats.get('weapon_stats', [])
|
|
87
|
+
if weapon_stats:
|
|
88
|
+
print(f"\n🔫 Top 5 Weapons by Kills:")
|
|
89
|
+
for i, weapon in enumerate(weapon_stats[:5], 1):
|
|
90
|
+
print(f" {i}. {weapon['id']}: {weapon['kills']:,} kills")
|
|
91
|
+
|
|
92
|
+
# Show overall stats
|
|
93
|
+
overall_stats = parsed_stats.get('overall_stats', {})
|
|
94
|
+
if overall_stats:
|
|
95
|
+
print(f"\n📈 Overall Statistics:")
|
|
96
|
+
print(f" Total Kills: {overall_stats.get('total_kills', 0):,}")
|
|
97
|
+
print(f" Total Deaths: {overall_stats.get('total_deaths', 0):,}")
|
|
98
|
+
print(f" Total Headshots: {overall_stats.get('total_headshots', 0):,}")
|
|
99
|
+
print(f" Total Assists: {overall_stats.get('total_assists', 0):,}")
|
|
100
|
+
print(f" Time Played: {overall_stats.get('total_time_played', 0):,} seconds")
|
|
101
|
+
|
|
102
|
+
if overall_stats.get('total_kills', 0) > 0:
|
|
103
|
+
kd_ratio = overall_stats['total_kills'] / max(overall_stats.get('total_deaths', 1), 1)
|
|
104
|
+
print(f" K/D Ratio: {kd_ratio:.2f}")
|
|
105
|
+
|
|
106
|
+
# 3. Batch operations example
|
|
107
|
+
print("\n📦 Batch Operations Example:")
|
|
108
|
+
print("-" * 40)
|
|
109
|
+
|
|
110
|
+
# Example credentials (replace with real ones)
|
|
111
|
+
test_credentials = [
|
|
112
|
+
"anonymous:player1_credential_here",
|
|
113
|
+
"anonymous:player2_credential_here",
|
|
114
|
+
"anonymous:player3_credential_here"
|
|
115
|
+
]
|
|
116
|
+
|
|
117
|
+
print("📊 Getting batch profiles for multiple players...")
|
|
118
|
+
|
|
119
|
+
# Note: This will likely fail with placeholder credentials
|
|
120
|
+
try:
|
|
121
|
+
batch_stats = client.get_batch_profiles(test_credentials)
|
|
122
|
+
|
|
123
|
+
if isinstance(batch_stats, dict) and batch_stats:
|
|
124
|
+
print(f"✅ Retrieved stats for {len(batch_stats)} players")
|
|
125
|
+
|
|
126
|
+
for credential, data in batch_stats.items():
|
|
127
|
+
if isinstance(data, dict):
|
|
128
|
+
game_save = data.get('_game_save', {})
|
|
129
|
+
rating = game_save.get('rating', 0)
|
|
130
|
+
print(f" Player: {credential[:20]}... - Rating: {rating}")
|
|
131
|
+
else:
|
|
132
|
+
print("⚠️ Batch profiles returned empty data (expected with placeholder credentials)")
|
|
133
|
+
|
|
134
|
+
except Exception as e:
|
|
135
|
+
print(f"⚠️ Batch profile request failed: {e}")
|
|
136
|
+
print(" This is expected with placeholder credentials")
|
|
137
|
+
|
|
138
|
+
# 4. Advanced usage example
|
|
139
|
+
print("\n🎯 Advanced Usage Example:")
|
|
140
|
+
print("-" * 40)
|
|
141
|
+
|
|
142
|
+
print("💡 Combining dogtag search with stats parsing:")
|
|
143
|
+
|
|
144
|
+
def analyze_player_performance(client, dogtag):
|
|
145
|
+
"""Analyze a player's performance in detail."""
|
|
146
|
+
print(f"\n🔍 Analyzing player: {dogtag}")
|
|
147
|
+
|
|
148
|
+
# Get player stats
|
|
149
|
+
stats = client.get_player_stats_by_dogtag(dogtag)
|
|
150
|
+
|
|
151
|
+
if 'error' in stats:
|
|
152
|
+
print(f"❌ {stats['error']}")
|
|
153
|
+
return None
|
|
154
|
+
|
|
155
|
+
# Parse stats
|
|
156
|
+
parsed = client.parse_player_stats(stats)
|
|
157
|
+
|
|
158
|
+
# Performance analysis
|
|
159
|
+
overall = parsed.get('overall_stats', {})
|
|
160
|
+
weapons = parsed.get('weapon_stats', [])
|
|
161
|
+
|
|
162
|
+
print(f"📊 Performance Summary:")
|
|
163
|
+
print(f" Rating: {parsed.get('rating', 0)}")
|
|
164
|
+
print(f" K/D Ratio: {overall.get('total_kills', 0) / max(overall.get('total_deaths', 1), 1):.2f}")
|
|
165
|
+
print(f" Headshot %: {(overall.get('total_headshots', 0) / max(overall.get('total_kills', 1), 1) * 100):.1f}%")
|
|
166
|
+
print(f" Accuracy: {(overall.get('bullet.hits', 0) / max(overall.get('bullet.shots', 1), 1) * 100):.1f}%")
|
|
167
|
+
|
|
168
|
+
# Weapon analysis
|
|
169
|
+
if weapons:
|
|
170
|
+
print(f"\n🔫 Weapon Analysis:")
|
|
171
|
+
total_kills = sum(w['kills'] for w in weapons)
|
|
172
|
+
print(f" Total Weapon Kills: {total_kills:,}")
|
|
173
|
+
|
|
174
|
+
# Find favorite weapon
|
|
175
|
+
if weapons:
|
|
176
|
+
favorite = max(weapons, key=lambda x: x['kills'])
|
|
177
|
+
print(f" Favorite Weapon: {favorite['id']} ({favorite['kills']:,} kills)")
|
|
178
|
+
|
|
179
|
+
# Calculate weapon efficiency
|
|
180
|
+
if favorite['shots'] > 0:
|
|
181
|
+
accuracy = (favorite['hits'] / favorite['shots']) * 100
|
|
182
|
+
print(f" Favorite Weapon Accuracy: {accuracy:.1f}%")
|
|
183
|
+
|
|
184
|
+
# Progress analysis
|
|
185
|
+
progress = parsed.get('progress', [])
|
|
186
|
+
if progress:
|
|
187
|
+
completed_levels = len([p for p in progress if p.get('objective3', False) == False])
|
|
188
|
+
total_levels = len(progress)
|
|
189
|
+
completion_rate = (completed_levels / total_levels * 100) if total_levels > 0 else 0
|
|
190
|
+
print(f"\n🎮 Campaign Progress:")
|
|
191
|
+
print(f" Completed Levels: {completed_levels}/{total_levels}")
|
|
192
|
+
print(f" Completion Rate: {completion_rate:.1f}%")
|
|
193
|
+
|
|
194
|
+
return parsed
|
|
195
|
+
|
|
196
|
+
# Try to analyze a player (will fail with placeholder)
|
|
197
|
+
try:
|
|
198
|
+
analyze_player_performance(client, "f55f")
|
|
199
|
+
except Exception as e:
|
|
200
|
+
print(f"⚠️ Analysis failed: {e}")
|
|
201
|
+
print(" This is expected with placeholder credentials")
|
|
202
|
+
|
|
203
|
+
# 5. Dogtag conversion utility
|
|
204
|
+
print("\n🔧 Dogtag Conversion Utility:")
|
|
205
|
+
print("-" * 40)
|
|
206
|
+
|
|
207
|
+
def dogtag_info(dogtag):
|
|
208
|
+
"""Provide information about a dogtag."""
|
|
209
|
+
alias = client.convert_dogtag_to_alias(dogtag)
|
|
210
|
+
print(f"🏷️ Dogtag: {dogtag}")
|
|
211
|
+
print(f" Alias: {alias}")
|
|
212
|
+
print(f" Format: {'Valid' if len(dogtag) == 4 and all(c in '0123456789abcdefABCDEF' for c in dogtag) else 'Invalid'}")
|
|
213
|
+
|
|
214
|
+
# Try to get player info
|
|
215
|
+
try:
|
|
216
|
+
player_info = client.get_alias_info(alias)
|
|
217
|
+
if player_info.get('account'):
|
|
218
|
+
print(f" Account ID: {player_info.get('account')}")
|
|
219
|
+
print(f" Type: {player_info.get('type')}")
|
|
220
|
+
else:
|
|
221
|
+
print(" Status: Not found in database")
|
|
222
|
+
except:
|
|
223
|
+
print(" Status: Unable to lookup")
|
|
224
|
+
|
|
225
|
+
# Show info for example dogtags
|
|
226
|
+
for dogtag in test_dogtags:
|
|
227
|
+
dogtag_info(dogtag)
|
|
228
|
+
print()
|
|
229
|
+
|
|
230
|
+
# Clean up
|
|
231
|
+
print("🧹 Cleaning up...")
|
|
232
|
+
try:
|
|
233
|
+
client.close()
|
|
234
|
+
print("✅ Connection closed successfully!")
|
|
235
|
+
|
|
236
|
+
except Exception as e:
|
|
237
|
+
print(f"⚠️ Error during cleanup: {e}")
|
|
238
|
+
|
|
239
|
+
print("\n🎉 Player Statistics Demonstration Complete!")
|
|
240
|
+
print("\n📚 What You Learned:")
|
|
241
|
+
print(" 🏷️ Dogtag/alias conversion system")
|
|
242
|
+
print(" 🔍 Player search by dogtag")
|
|
243
|
+
print(" 📊 Detailed statistics retrieval")
|
|
244
|
+
print(" 📦 Batch profile operations")
|
|
245
|
+
print(" 📈 Performance analysis tools")
|
|
246
|
+
print(" 🔧 Utility functions for dogtag management")
|
|
247
|
+
print(" 🎮 Campaign progress tracking")
|
|
248
|
+
print(" 🔫 Weapon statistics analysis")
|
|
249
|
+
|
|
250
|
+
print("\n🎮 Ready to build advanced player analytics!")
|
|
251
|
+
|
|
252
|
+
if __name__ == "__main__":
|
|
253
|
+
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.5"
|
|
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.5",
|
|
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",
|
|
@@ -38,6 +38,7 @@ class MC5Client:
|
|
|
38
38
|
BASE_URLS = {
|
|
39
39
|
"auth": "https://eur-janus.gameloft.com:443",
|
|
40
40
|
"osiris": "https://eur-osiris.gameloft.com:443",
|
|
41
|
+
"janus": "https://eur-janus.gameloft.com",
|
|
41
42
|
"olympus": "https://eur-olympus.gameloft.com:443",
|
|
42
43
|
"iris": "https://eur-iris.gameloft.com:443",
|
|
43
44
|
"hermes": "https://eur-hermes.gameloft.com",
|
|
@@ -1724,6 +1725,183 @@ class MC5Client:
|
|
|
1724
1725
|
|
|
1725
1726
|
return config_data
|
|
1726
1727
|
|
|
1728
|
+
# Batch Operations
|
|
1729
|
+
|
|
1730
|
+
def get_batch_profiles(self, credentials: List[str], include_fields: List[str] = None) -> Dict[str, Any]:
|
|
1731
|
+
"""
|
|
1732
|
+
Get batch player profiles with detailed statistics and game save data.
|
|
1733
|
+
|
|
1734
|
+
Args:
|
|
1735
|
+
credentials: List of player credentials to fetch
|
|
1736
|
+
include_fields: List of fields to include (default: ['_game_save', 'inventory'])
|
|
1737
|
+
|
|
1738
|
+
Returns:
|
|
1739
|
+
Dictionary with player profiles containing detailed statistics
|
|
1740
|
+
"""
|
|
1741
|
+
if include_fields is None:
|
|
1742
|
+
include_fields = ['_game_save', 'inventory']
|
|
1743
|
+
|
|
1744
|
+
url = "https://app-468561b3-9ecd-4d21-8241-30ed288f4d8b.gold0009.gameloft.com/1875/windows/09/public/OfficialScripts/mc5Portal.wsgi"
|
|
1745
|
+
|
|
1746
|
+
data = {
|
|
1747
|
+
'op_code': 'get_batch_profiles',
|
|
1748
|
+
'client_id': self.client_id,
|
|
1749
|
+
'credentials': ','.join(credentials),
|
|
1750
|
+
'pandora': f"https://vgold-eur.gameloft.com/{self.client_id}",
|
|
1751
|
+
'include_fields': ','.join(include_fields)
|
|
1752
|
+
}
|
|
1753
|
+
|
|
1754
|
+
headers = {
|
|
1755
|
+
'Accept': '*/*',
|
|
1756
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
1757
|
+
'accept-encoding': 'identity'
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
return self._make_request("POST", url, data=data, headers=headers)
|
|
1761
|
+
|
|
1762
|
+
def get_player_stats_by_dogtag(self, dogtag: str) -> Dict[str, Any]:
|
|
1763
|
+
"""
|
|
1764
|
+
Get detailed player statistics using their dogtag (in-game ID).
|
|
1765
|
+
|
|
1766
|
+
Args:
|
|
1767
|
+
dogtag: Player's dogtag in XXXX format (hexadecimal)
|
|
1768
|
+
|
|
1769
|
+
Returns:
|
|
1770
|
+
Player statistics and profile information
|
|
1771
|
+
"""
|
|
1772
|
+
# Convert dogtag to alias for API lookup
|
|
1773
|
+
alias = self.convert_dogtag_to_alias(dogtag)
|
|
1774
|
+
|
|
1775
|
+
# Get player info using alias
|
|
1776
|
+
player_info = self.get_alias_info(alias)
|
|
1777
|
+
if not player_info.get('credential'):
|
|
1778
|
+
return {'error': f'Player not found for dogtag: {dogtag}', 'alias': alias}
|
|
1779
|
+
|
|
1780
|
+
# Get detailed stats using the credential
|
|
1781
|
+
try:
|
|
1782
|
+
stats = self.get_batch_profiles([player_info['credential']])
|
|
1783
|
+
|
|
1784
|
+
# Add dogtag and alias info to the response
|
|
1785
|
+
if player_info['credential'] in stats:
|
|
1786
|
+
stats[player_info['credential']]['dogtag'] = dogtag
|
|
1787
|
+
stats[player_info['credential']]['alias'] = alias
|
|
1788
|
+
stats[player_info['credential']]['player_info'] = player_info
|
|
1789
|
+
|
|
1790
|
+
return stats
|
|
1791
|
+
|
|
1792
|
+
except Exception as e:
|
|
1793
|
+
return {
|
|
1794
|
+
'error': f'Failed to get stats for dogtag {dogtag}: {e}',
|
|
1795
|
+
'dogtag': dogtag,
|
|
1796
|
+
'alias': alias,
|
|
1797
|
+
'player_info': player_info
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
def search_player_by_dogtag(self, dogtag: str) -> Dict[str, Any]:
|
|
1801
|
+
"""
|
|
1802
|
+
Search for a player using their dogtag and return their profile information.
|
|
1803
|
+
|
|
1804
|
+
Args:
|
|
1805
|
+
dogtag: Player's dogtag in XXXX format (hexadecimal)
|
|
1806
|
+
|
|
1807
|
+
Returns:
|
|
1808
|
+
Complete player information including stats if found
|
|
1809
|
+
"""
|
|
1810
|
+
return self.get_player_stats_by_dogtag(dogtag)
|
|
1811
|
+
|
|
1812
|
+
def get_player_detailed_stats(self, credential: str) -> Dict[str, Any]:
|
|
1813
|
+
"""
|
|
1814
|
+
Get detailed player statistics including game save and inventory.
|
|
1815
|
+
|
|
1816
|
+
Args:
|
|
1817
|
+
credential: Player's credential
|
|
1818
|
+
|
|
1819
|
+
Returns:
|
|
1820
|
+
Detailed player statistics and game data
|
|
1821
|
+
"""
|
|
1822
|
+
return self.get_batch_profiles([credential])
|
|
1823
|
+
|
|
1824
|
+
def parse_player_stats(self, stats_data: Dict[str, Any]) -> Dict[str, Any]:
|
|
1825
|
+
"""
|
|
1826
|
+
Parse and structure player statistics for easier consumption.
|
|
1827
|
+
|
|
1828
|
+
Args:
|
|
1829
|
+
stats_data: Raw stats data from get_batch_profiles
|
|
1830
|
+
|
|
1831
|
+
Returns:
|
|
1832
|
+
Structured player statistics
|
|
1833
|
+
"""
|
|
1834
|
+
if not stats_data or not isinstance(stats_data, dict):
|
|
1835
|
+
return {'error': 'Invalid stats data'}
|
|
1836
|
+
|
|
1837
|
+
# Get the first (and likely only) player's data
|
|
1838
|
+
player_credential = list(stats_data.keys())[0] if stats_data else None
|
|
1839
|
+
if not player_credential or player_credential not in stats_data:
|
|
1840
|
+
return {'error': 'No player data found'}
|
|
1841
|
+
|
|
1842
|
+
player_data = stats_data[player_credential]
|
|
1843
|
+
|
|
1844
|
+
# Extract game save data
|
|
1845
|
+
game_save = player_data.get('_game_save', {})
|
|
1846
|
+
inventory = player_data.get('inventory', {})
|
|
1847
|
+
|
|
1848
|
+
# Parse statistics
|
|
1849
|
+
parsed_stats = {
|
|
1850
|
+
'credential': player_credential,
|
|
1851
|
+
'rating': game_save.get('rating', 0),
|
|
1852
|
+
'rating_duel': game_save.get('rating_duel', 0),
|
|
1853
|
+
'rating_last': game_save.get('rating_last', 0),
|
|
1854
|
+
'current_skill': game_save.get('current_skill', 'unknown'),
|
|
1855
|
+
'current_weapon': game_save.get('current_weapon', 'unknown'),
|
|
1856
|
+
'current_loadout': game_save.get('current_loadout', 0),
|
|
1857
|
+
'kill_signature': game_save.get('killsig', {}),
|
|
1858
|
+
'progress': game_save.get('progress', []),
|
|
1859
|
+
'loadouts': game_save.get('loadouts', []),
|
|
1860
|
+
'statistics': game_save.get('statistics', {}),
|
|
1861
|
+
'inventory': inventory,
|
|
1862
|
+
'xp': inventory.get('xp', 0),
|
|
1863
|
+
'vip_points': inventory.get('vip_points', 0)
|
|
1864
|
+
}
|
|
1865
|
+
|
|
1866
|
+
# Parse weapon statistics
|
|
1867
|
+
weapons = inventory.get('weapons', {})
|
|
1868
|
+
weapon_stats = []
|
|
1869
|
+
|
|
1870
|
+
for weapon_id, weapon_data in weapons.items():
|
|
1871
|
+
if isinstance(weapon_data, dict):
|
|
1872
|
+
weapon_stats.append({
|
|
1873
|
+
'id': weapon_id,
|
|
1874
|
+
'kills': weapon_data.get('kills', 0),
|
|
1875
|
+
'shots': weapon_data.get('shots', 0),
|
|
1876
|
+
'hits': weapon_data.get('hits', 0),
|
|
1877
|
+
'score': weapon_data.get('score', 0),
|
|
1878
|
+
'time_used': weapon_data.get('time_used', 0)
|
|
1879
|
+
})
|
|
1880
|
+
|
|
1881
|
+
# Sort by kills
|
|
1882
|
+
weapon_stats.sort(key=lambda x: x['kills'], reverse=True)
|
|
1883
|
+
parsed_stats['weapon_stats'] = weapon_stats
|
|
1884
|
+
|
|
1885
|
+
# Parse overall statistics
|
|
1886
|
+
stats = game_save.get('statistics', {})
|
|
1887
|
+
if stats:
|
|
1888
|
+
sp_stats = stats.get('sp', {})
|
|
1889
|
+
mp_stats = stats.get('mp', {})
|
|
1890
|
+
|
|
1891
|
+
parsed_stats['overall_stats'] = {
|
|
1892
|
+
'total_kills': sp_stats.get('kill.total', 0) + mp_stats.get('kill.total', 0),
|
|
1893
|
+
'total_deaths': sp_stats.get('death.total', 0) + mp_stats.get('death.total', 0),
|
|
1894
|
+
'total_headshots': sp_stats.get('kill.headshots', 0) + mp_stats.get('kill.headshots', 0),
|
|
1895
|
+
'total_assists': sp_stats.get('kill.assists', 0) + mp_stats.get('kill.assists', 0),
|
|
1896
|
+
'total_time_played': sp_stats.get('time.played', 0) + mp_stats.get('time.played', 0),
|
|
1897
|
+
'sp_kills': sp_stats.get('kill.total', 0),
|
|
1898
|
+
'mp_kills': mp_stats.get('kill.total', 0),
|
|
1899
|
+
'sp_headshots': sp_stats.get('kill.headshots', 0),
|
|
1900
|
+
'mp_headshots': mp_stats.get('kill.headshots', 0)
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
return parsed_stats
|
|
1904
|
+
|
|
1727
1905
|
def __enter__(self):
|
|
1728
1906
|
"""Context manager entry."""
|
|
1729
1907
|
return self
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mc5-api-client
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.5
|
|
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
|
|
@@ -114,68 +114,6 @@ pip install .
|
|
|
114
114
|
✅ **PyPI URL**: https://pypi.org/project/mc5_api_client/
|
|
115
115
|
✅ **Installation**: `pip install mc5_api_client`
|
|
116
116
|
✅ **CLI Command**: `mc5 --help`
|
|
117
|
-
|
|
118
|
-
### 📦 Package Files
|
|
119
|
-
|
|
120
|
-
✅ **Source Distribution**: `dist/mc5_api_client-1.0.1.tar.gz`
|
|
121
|
-
✅ **Wheel Distribution**: `dist/mc5_api_client-1.0.1-py3-none-any.whl`
|
|
122
|
-
|
|
123
|
-
### 🔧 Build Status
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
### Step 1: Install the Library
|
|
127
|
-
|
|
128
|
-
Just run this in your terminal (Command Prompt/PowerShell):
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
pip install mc5_api_client
|
|
132
|
-
```
|
|
133
|
-
|
|
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
|
-
```
|
|
144
|
-
|
|
145
|
-
### Step 3: Your First Program
|
|
146
|
-
|
|
147
|
-
Copy and paste this simple example to get started:
|
|
148
|
-
|
|
149
|
-
```python
|
|
150
|
-
# Save this as my_mc5_script.py
|
|
151
|
-
from mc5_api_client import MC5Client
|
|
152
|
-
|
|
153
|
-
# Replace with your actual credentials
|
|
154
|
-
username = "YOUR_USERNAME_HERE"
|
|
155
|
-
password = "YOUR_PASSWORD_HERE"
|
|
156
|
-
|
|
157
|
-
# Create client and login
|
|
158
|
-
client = MC5Client(username=username, password=password)
|
|
159
|
-
|
|
160
|
-
# See what's happening in the game
|
|
161
|
-
events = client.get_events()
|
|
162
|
-
print(f"There are {len(events)} active events right now!")
|
|
163
|
-
|
|
164
|
-
# Don't forget to close the connection
|
|
165
|
-
client.close()
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
**What just happened?**
|
|
169
|
-
- We imported the MC5 client
|
|
170
|
-
- We logged in with your credentials (replace with yours!)
|
|
171
|
-
- We got your profile info
|
|
172
|
-
- We checked what events are active
|
|
173
|
-
- We cleaned up properly
|
|
174
|
-
|
|
175
|
-
### Step 3: Try the Cool CLI Tool
|
|
176
|
-
|
|
177
|
-
The library comes with an awesome command-line tool! Check this out:
|
|
178
|
-
|
|
179
117
|
```bash
|
|
180
118
|
# Generate a token (your login key)
|
|
181
119
|
mc5 generate-token --username "anonymous:your_credential" --password "your_password" --save
|
|
@@ -942,6 +880,7 @@ The library comes with comprehensive examples to get you started:
|
|
|
942
880
|
- `examples/private_messaging.py` - Private messaging and inbox management
|
|
943
881
|
- `examples/message_management.py` - Advanced message management and bulk deletion
|
|
944
882
|
- `examples/advanced_features.py` - Events, account management, alias system, game config
|
|
883
|
+
- `examples/player_stats.py` - Player statistics, batch profiles, dogtag search
|
|
945
884
|
|
|
946
885
|
### 🚀 Advanced Examples
|
|
947
886
|
- Squad management bot with automated updates
|
|
@@ -1010,14 +949,44 @@ The library comes with comprehensive examples to get you started:
|
|
|
1010
949
|
- ✅ Support for cross-platform data transfer
|
|
1011
950
|
- ✅ Account verification and validation
|
|
1012
951
|
|
|
1013
|
-
###
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
952
|
+
### 📊 Player Statistics & Batch Profiles
|
|
953
|
+
|
|
954
|
+
Get detailed player statistics using dogtags (in-game IDs) or credentials:
|
|
955
|
+
|
|
956
|
+
```python
|
|
957
|
+
# Search player by their in-game dogtag
|
|
958
|
+
player_stats = client.get_player_stats_by_dogtag("f55f")
|
|
959
|
+
print(f"Player found: {player_stats.get('player_info', {}).get('account', 'Unknown')}")
|
|
960
|
+
|
|
961
|
+
# Parse and analyze statistics
|
|
962
|
+
parsed = client.parse_player_stats(player_stats)
|
|
963
|
+
print(f"Rating: {parsed.get('rating', 0)}")
|
|
964
|
+
print(f"K/D Ratio: {parsed.get('overall_stats', {}).get('total_kills', 0) / max(parsed.get('overall_stats', {}).get('total_deaths', 1), 1):.2f}")
|
|
965
|
+
|
|
966
|
+
# Get detailed stats for multiple players
|
|
967
|
+
credentials = ["player1_cred", "player2_cred", "player3_cred"]
|
|
968
|
+
batch_stats = client.get_batch_profiles(credentials)
|
|
969
|
+
|
|
970
|
+
# Search players using dogtags
|
|
971
|
+
for dogtag in ["f55f", "ff11", "g6765"]:
|
|
972
|
+
player = client.search_player_by_dogtag(dogtag)
|
|
973
|
+
if 'error' not in player:
|
|
974
|
+
print(f"Found: {player.get('player_info', {}).get('account')}")
|
|
975
|
+
```
|
|
976
|
+
|
|
977
|
+
### 📊 Player Statistics & Batch Profiles (6+ Methods)
|
|
978
|
+
- ✅ Get batch player profiles with detailed statistics
|
|
979
|
+
- ✅ Search players by dogtag (in-game ID)
|
|
980
|
+
- ✅ Get detailed player statistics using credentials
|
|
981
|
+
- ✅ Parse and structure player statistics
|
|
982
|
+
- ✅ Convert dogtags to aliases for API lookup
|
|
983
|
+
- ✅ Combine alias lookup with stats retrieval
|
|
984
|
+
- ✅ Support for multiple player batch operations
|
|
985
|
+
- ✅ Detailed game save and inventory data access
|
|
986
|
+
- ✅ Weapon statistics and performance analysis
|
|
987
|
+
- ✅ Campaign progress tracking
|
|
988
|
+
- ✅ Overall statistics calculation (K/D, accuracy, etc.)
|
|
989
|
+
- ✅ Player performance analysis tools
|
|
1021
990
|
|
|
1022
991
|
### ⚙️ Game Configuration (4+ Methods)
|
|
1023
992
|
- ✅ Get asset hash metadata
|
|
@@ -14,6 +14,7 @@ examples/clan_management.py
|
|
|
14
14
|
examples/clan_management_complete.py
|
|
15
15
|
examples/events_and_tasks.py
|
|
16
16
|
examples/message_management.py
|
|
17
|
+
examples/player_stats.py
|
|
17
18
|
examples/private_messaging.py
|
|
18
19
|
examples/squad_management.py
|
|
19
20
|
examples/squad_wall_management.py
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
|
|
5
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
-
|
|
8
|
-
## [1.0.0] - 2026-02-02
|
|
9
|
-
|
|
10
|
-
### Added
|
|
11
|
-
- Initial release of MC5 API Client by Chizoba
|
|
12
|
-
- Comprehensive authentication system with token generation
|
|
13
|
-
- Support for both user and admin authentication
|
|
14
|
-
- Modern CLI interface with Rich formatting and debug capabilities
|
|
15
|
-
- Full API coverage including:
|
|
16
|
-
- Profile management
|
|
17
|
-
- Clan operations
|
|
18
|
-
- Friend management
|
|
19
|
-
- Messaging system
|
|
20
|
-
- Events and tasks
|
|
21
|
-
- Leaderboard access
|
|
22
|
-
- Game objects
|
|
23
|
-
- Asset metadata
|
|
24
|
-
- Alias lookup
|
|
25
|
-
- Automatic token refresh functionality
|
|
26
|
-
- Comprehensive error handling with custom exceptions
|
|
27
|
-
- Type hints throughout the codebase
|
|
28
|
-
- Extensive documentation and examples
|
|
29
|
-
- Unit test coverage
|
|
30
|
-
- PyPI package configuration
|
|
31
|
-
- Development environment setup
|
|
32
|
-
- Python 3.11+ support (beta version)
|
|
33
|
-
|
|
34
|
-
### Features
|
|
35
|
-
- **Authentication**: Easy token generation and management
|
|
36
|
-
- **CLI**: Rich command-line interface with progress indicators
|
|
37
|
-
- **Auto-refresh**: Automatic token renewal
|
|
38
|
-
- **Error Handling**: Comprehensive exception hierarchy
|
|
39
|
-
- **Type Safety**: Full type annotation support
|
|
40
|
-
- **Documentation**: Detailed README and examples
|
|
41
|
-
- **Testing**: Unit tests with mocking
|
|
42
|
-
- **Configuration**: Persistent config and token storage
|
|
43
|
-
|
|
44
|
-
### CLI Commands
|
|
45
|
-
- `generate-token` - Generate user access tokens
|
|
46
|
-
- `generate-admin-token` - Generate admin access tokens
|
|
47
|
-
- `validate-token` - Validate saved tokens
|
|
48
|
-
- `show-config` - Display configuration
|
|
49
|
-
- `clear-config` - Clear saved data
|
|
50
|
-
|
|
51
|
-
### API Endpoints Supported
|
|
52
|
-
- Authentication (Janus)
|
|
53
|
-
- Profile management (Osiris)
|
|
54
|
-
- Clan operations (Osiris)
|
|
55
|
-
- Friend system (Osiris)
|
|
56
|
-
- Messaging (Osiris)
|
|
57
|
-
- Events (Osiris)
|
|
58
|
-
- Leaderboards (Osiris/Olympus)
|
|
59
|
-
- Game objects (Iris)
|
|
60
|
-
- Asset metadata (Iris)
|
|
61
|
-
- Alias lookup (Janus)
|
|
62
|
-
|
|
63
|
-
### Installation
|
|
64
|
-
```bash
|
|
65
|
-
pip install mc5-api-client
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Development Installation
|
|
69
|
-
```bash
|
|
70
|
-
pip install mc5-api-client[dev]
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
### Example Usage
|
|
74
|
-
```python
|
|
75
|
-
from mc5_api_client import MC5Client
|
|
76
|
-
|
|
77
|
-
with MC5Client(username="user", password="pass") as client:
|
|
78
|
-
profile = client.get_profile()
|
|
79
|
-
events = client.get_events()
|
|
80
|
-
client.send_private_message("target", "Hello!")
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
### CLI Usage
|
|
84
|
-
```bash
|
|
85
|
-
mc5 generate-token --username "user" --password "pass" --save
|
|
86
|
-
mc5 validate-token
|
|
87
|
-
mc5 show-config
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
---
|
|
91
|
-
|
|
92
|
-
## [Unreleased]
|
|
93
|
-
|
|
94
|
-
### Planned
|
|
95
|
-
- Additional API endpoints
|
|
96
|
-
- Enhanced CLI features
|
|
97
|
-
- Performance optimizations
|
|
98
|
-
- More examples and tutorials
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{mc5_api_client-1.0.3 → mc5_api_client-1.0.5}/src/mc5_api_client.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|