-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when accessing current war data for clans that haven't participated in wars (for a longer time) #262
Comments
#2PPP is a dead clan with zero members |
if i make a new clan and then call this endpoint it will still return the same ig |
the api returns for the clantag you provided: {
"state": "notInWar",
"clan": {
"badgeUrls": {
"small": "https://api-assets.clashofclans.com/badges/70/H39b_-WLZGtZVWQ0hqTkE-Tn2AaQnQWy_Iz4yBlvL0M.png",
"large": "https://api-assets.clashofclans.com/badges/512/H39b_-WLZGtZVWQ0hqTkE-Tn2AaQnQWy_Iz4yBlvL0M.png",
"medium": "https://api-assets.clashofclans.com/badges/200/H39b_-WLZGtZVWQ0hqTkE-Tn2AaQnQWy_Iz4yBlvL0M.png"
},
"clanLevel": 0,
"attacks": 0,
"stars": 0,
"destructionPercentage": 0
},
"opponent": {
"badgeUrls": {
"small": "https://api-assets.clashofclans.com/badges/70/H39b_-WLZGtZVWQ0hqTkE-Tn2AaQnQWy_Iz4yBlvL0M.png",
"large": "https://api-assets.clashofclans.com/badges/512/H39b_-WLZGtZVWQ0hqTkE-Tn2AaQnQWy_Iz4yBlvL0M.png",
"medium": "https://api-assets.clashofclans.com/badges/200/H39b_-WLZGtZVWQ0hqTkE-Tn2AaQnQWy_Iz4yBlvL0M.png"
},
"clanLevel": 0,
"attacks": 0,
"stars": 0,
"destructionPercentage": 0
}
} with a response status of 200. This is nothing special for new clans. This can be observed for every clan when they don't start a new war and the last war isn't available anymore (normally after around 2-3 days). Doing the same request with coc.py gives you a war object corresponding to the data, which you can see looking at the {'state': 'notInWar', 'clan': {'badgeUrls': {'small': 'https://api-assets.clashofclans.com/badges/70/H39b_-WLZGtZVWQ0hqTkE-Tn2AaQnQWy_Iz4yBlvL0M.png', 'large': 'https://api-assets.clashofclans.com/badges/512/H39b_-WLZGtZVWQ0hqTkE-Tn2AaQnQWy_Iz4yBlvL0M.png', 'medium': 'https://api-assets.clashofclans.com/badges/200/H39b_-WLZGtZVWQ0hqTkE-Tn2AaQnQWy_Iz4yBlvL0M.png'}, 'clanLevel': 0, 'attacks': 0, 'stars': 0, 'destructionPercentage': 0.0}, 'opponent': {'badgeUrls': {'small': 'https://api-assets.clashofclans.com/badges/70/H39b_-WLZGtZVWQ0hqTkE-Tn2AaQnQWy_Iz4yBlvL0M.png', 'large': 'https://api-assets.clashofclans.com/badges/512/H39b_-WLZGtZVWQ0hqTkE-Tn2AaQnQWy_Iz4yBlvL0M.png', 'medium': 'https://api-assets.clashofclans.com/badges/200/H39b_-WLZGtZVWQ0hqTkE-Tn2AaQnQWy_Iz4yBlvL0M.png'}, 'clanLevel': 0, 'attacks': 0, 'stars': 0, 'destructionPercentage': 0.0}, 'status_code': 200, 'timestamp': 1738656910.596015, '_response_retry': 120, 'response_time': 110.416983} The NotFound exception of coc.py corresponds to a 404 response code. While I agree that the way the api returns What I normally do, is checking if the war has a |
I'm experiencing an issue where methods like
get_current_war
andget_clan_war
fail if the clan hasn't participated in any wars, even when the war log is set to public. This results in an error when trying to retrieve war data for such clans.For example, using a valid clan tag like
#2PPP
that hasn't fought any wars yet leads to an error when calling these methods. It would be great if there could be better handling for such cases, perhaps returning a message like "Not found" or similar when the clan doesn't have any war data.Current Behavior:
The
get_current_war
andget_clan_war
methods throw an error when the clan hasn't participated in any wars.Steps to Reproduce:
The text was updated successfully, but these errors were encountered: