Skip to content

Commit 8daa016

Browse files
authored
Merge pull request #227 from mathsman5133/fix/http-error
fix: catch&raise stray response HTTP status codes
2 parents 8eb2142 + 50258e0 commit 8daa016

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

coc/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
SOFTWARE.
2323
"""
2424

25-
__version__ = "3.3.0"
25+
__version__ = "3.3.1"
2626

2727
from .abc import BasePlayer, BaseClan
2828
from .clans import RankedClan, Clan

coc/http.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,14 +353,16 @@ async def request(self, route, **kwargs):
353353
await asyncio.sleep(tries * 2 + 1)
354354
continue
355355

356+
# catch any stray status codes
357+
raise HTTPException(response, data)
358+
356359
except asyncio.TimeoutError:
357360
# api timed out, retry again
358361
if tries > 3:
359362
raise GatewayError("The API timed out waiting for the request.")
360363

361364
await asyncio.sleep(tries * 2 + 1)
362365
continue
363-
raise
364366

365367
else:
366368
if response.status in (500, 502, 504):

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
project = 'coc'
1616
copyright = '2022, mathsman5133'
1717
author = 'mathsman5133'
18-
release = '3.3.0'
18+
release = '3.3.1'
1919

2020
# -- General configuration ---------------------------------------------------
2121
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

docs/miscellaneous/changelog.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ Changelog
77
This page keeps a fairly detailed, human readable version
88
of what has changed, and whats new for each version of the lib.
99

10+
v3.3.1
11+
------
12+
13+
Bugs Fixed:
14+
~~~~~~~~~~~
15+
- Fixed a behaviour where in some cases (when the API responds with an unusual status code), coc.py would not
16+
properly raise an :class:`HTTPException`
17+
1018
v3.3.0
1119
------
1220

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "coc.py"
77
authors = [{ name = "mathsman5133" }]
88
maintainers = [{ name = "majordoobie" }, { name = "MagicTheDev" }, { name = "Kuchenmampfer" },
99
{ name = "lukasthaler"}, { name = "doluk"}]
10-
version = "3.3.0"
10+
version = "3.3.1"
1111
description = "A python wrapper for the Clash of Clans API"
1212
requires-python = ">=3.7.3"
1313
readme = "README.rst"

0 commit comments

Comments
 (0)