|
19 | 19 | from tibiapy.models import TibiaResponse
|
20 | 20 | from tibiapy.parsers import (
|
21 | 21 | AuctionParser, BoostableBossesParser, BoostedCreaturesParser, CMPostArchiveParser, CharacterBazaarParser,
|
22 |
| - CharacterParser, CreatureParser, CreaturesSectionParser, EventScheduleParser, ForumAnnouncementParser, |
| 22 | + CharacterParser, CreatureParser, CreaturesSectionParser, EventScheduleParser, FansitesSectionParser, |
| 23 | + ForumAnnouncementParser, |
23 | 24 | ForumBoardParser, ForumSectionParser, ForumThreadParser, GuildParser, GuildWarsParser, GuildsSectionParser,
|
24 | 25 | HighscoresParser, HouseParser, HousesSectionParser, KillStatisticsParser, LeaderboardParser, NewsArchiveParser,
|
25 | 26 | NewsParser, SpellParser, SpellsSectionParser, WorldOverviewParser, WorldParser,
|
26 | 27 | )
|
27 | 28 | from tibiapy.urls import (
|
28 | 29 | get_auction_url, get_bazaar_url, get_boostable_bosses_url, get_character_url, get_cm_post_archive_url,
|
29 | 30 | get_community_boards_url, get_creature_url, get_creatures_section_url, get_event_schedule_url,
|
30 |
| - get_forum_announcement_url, get_forum_board_url, get_forum_post_url, get_forum_section_url, get_forum_thread_url, |
| 31 | + get_fansites_url, get_forum_announcement_url, get_forum_board_url, get_forum_post_url, get_forum_section_url, |
| 32 | + get_forum_thread_url, |
31 | 33 | get_guild_url, get_guild_wars_url, get_highscores_url, get_house_url, get_houses_section_url,
|
32 | 34 | get_kill_statistics_url, get_leaderboards_url, get_news_archive_url, get_news_url, get_spell_url,
|
33 | 35 | get_spells_section_url, get_support_boards_url, get_trade_boards_url, get_world_boards_url, get_world_guilds_url,
|
|
37 | 39 | if TYPE_CHECKING:
|
38 | 40 | from tibiapy.models import (
|
39 | 41 | AjaxPaginator, Auction, AuctionFilters, BoostableBosses, BoostedCreatures, BossEntry, CMPostArchive, Character,
|
40 |
| - CharacterBazaar, Creature, CreatureEntry, CreaturesSection, EventSchedule, ForumAnnouncement, ForumBoard, |
41 |
| - ForumSection, ForumThread, Guild, GuildWars, GuildsSection, Highscores, House, HousesSection, KillStatistics, |
42 |
| - Leaderboard, News, NewsArchive, Spell, SpellsSection, World, WorldOverview, |
| 42 | + CharacterBazaar, Creature, CreatureEntry, CreaturesSection, EventSchedule, FansitesSection, ForumAnnouncement, |
| 43 | + ForumBoard, ForumSection, ForumThread, Guild, GuildWars, GuildsSection, Highscores, House, HousesSection, |
| 44 | + KillStatistics, Leaderboard, News, NewsArchive, Spell, SpellsSection, World, WorldOverview, |
43 | 45 | )
|
44 | 46 |
|
45 | 47 | __all__ = (
|
@@ -1035,6 +1037,32 @@ async def fetch_guild_wars(self, name: str, *, test: bool = False) -> TibiaRespo
|
1035 | 1037 | response = await self._request("GET", get_guild_wars_url(name), test=test)
|
1036 | 1038 | return response.parse(GuildWarsParser.from_content)
|
1037 | 1039 |
|
| 1040 | + async def fetch_fansites_section(self, *, test: bool = False) -> TibiaResponse[FansitesSection]: |
| 1041 | + """Fetch the fansites section from Tibia.com. |
| 1042 | +
|
| 1043 | + .. versionadded:: 6.2.0 |
| 1044 | +
|
| 1045 | + Parameters |
| 1046 | + ---------- |
| 1047 | + test: |
| 1048 | + Whether to request the test website instead. |
| 1049 | +
|
| 1050 | + Returns |
| 1051 | + ------- |
| 1052 | + TibiaResponse[FansitesSection] |
| 1053 | + A response containing the fansites section. |
| 1054 | +
|
| 1055 | + Raises |
| 1056 | + ------ |
| 1057 | + Forbidden |
| 1058 | + If a 403 Forbidden error was returned. |
| 1059 | + This usually means that Tibia.com is rate-limiting the client because of too many requests. |
| 1060 | + NetworkError |
| 1061 | + If there's any connection errors during the request. |
| 1062 | + """ |
| 1063 | + response = await self._request("GET", get_fansites_url(), test=test) |
| 1064 | + return response.parse(FansitesSectionParser.from_content) |
| 1065 | + |
1038 | 1066 | # endregion
|
1039 | 1067 |
|
1040 | 1068 | # region Forums
|
|
0 commit comments