Skip to content

Commit 35c58fe

Browse files
committed
Updated changelog
1 parent 78ec014 commit 35c58fe

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Changelog
1111

1212
- Added support for the Character Bazaar
1313
- Added classes: ``CharacterBazaar``, ``ListedAuction`` and ``AuctionDetails`` and many auxiliary classes.
14+
- Client methods throw a ``SiteMaintenanceError`` when Tibia.com is under maintenance, to be able to tell apart from
15+
other network errors.
1416

1517
.. v3.2.2:
1618

docs/api.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,8 @@ Exceptions
678678

679679
.. autoclass:: NetworkError
680680

681+
.. autoclass:: SiteMaintenanceError
682+
681683
.. autoclass:: Forbidden
682684

683685
Utility functions

tibiapy/client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from tibiapy.character import Character
1414
from tibiapy.creature import BoostedCreature
1515
from tibiapy.enums import Category, HouseOrder, HouseStatus, HouseType, NewsCategory, NewsType, VocationFilter
16-
from tibiapy.errors import Forbidden, NetworkError, SiteMaintenance
16+
from tibiapy.errors import Forbidden, NetworkError, SiteMaintenanceError
1717
from tibiapy.event import EventSchedule
1818
from tibiapy.forum import CMPostArchive, ForumAnnouncement, ForumBoard, ForumPost, ForumThread, ListedBoard
1919
from tibiapy.guild import Guild, GuildWars, ListedGuild
@@ -185,7 +185,7 @@ async def _request(self, method, url, data=None, headers=None):
185185
async with self.session.request(method, url, data=data, headers=headers) as resp:
186186
log.info(f"{url} | {method} | {resp.status} {resp.reason}")
187187
if "maintenance.tibia.com" in str(resp.url):
188-
raise SiteMaintenance("Tibia.com is down for maintenance.")
188+
raise SiteMaintenanceError("Tibia.com is down for maintenance.")
189189
self._handle_status(resp.status)
190190
response = RawResponse(resp, time.perf_counter()-init_time)
191191
response.content = await resp.text()

tibiapy/errors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class Forbidden(NetworkError):
4444
"""
4545

4646

47-
class SiteMaintenance(NetworkError):
47+
class SiteMaintenanceError(NetworkError):
4848
"""A subclass of network error thrown when Tibia.com is down for maintenance.
4949
5050
When Tibia.com is under maintance, all sections of the website redirect to maintenance.tibia.com.

0 commit comments

Comments
 (0)