diff --git a/.gitignore b/.gitignore index 1720225..f5430aa 100644 --- a/.gitignore +++ b/.gitignore @@ -107,3 +107,5 @@ example.py # pycharm .idea + +.vscode diff --git a/README.md b/README.md index 93c0577..9aaec36 100644 --- a/README.md +++ b/README.md @@ -21,8 +21,6 @@ pip install pyxivapi * /character/search * /character/id -* /character/verify -* /character/update * /freecompany/search * /freecompany/id * /linkshell/search diff --git a/pyxivapi/__init__.py b/pyxivapi/__init__.py index 8f99a5b..1b84001 100644 --- a/pyxivapi/__init__.py +++ b/pyxivapi/__init__.py @@ -2,7 +2,20 @@ __author__ = 'Lethys' __license__ = 'MIT' __copyright__ = 'Copyright 2019 (c) Lethys' -__version__ = '0.2.1' +__version__ = '0.3.0' from .client import XIVAPIClient -from .exceptions import * +from .exceptions import ( + XIVAPIForbidden, + XIVAPIBadRequest, + XIVAPINotFound, + XIVAPIServiceUnavailable, + XIVAPIInvalidLanguage, + XIVAPIInvalidIndex, + XIVAPIInvalidColumns, + XIVAPIInvalidFilter, + XIVAPIInvalidWorlds, + XIVAPIInvalidDatacenter, + XIVAPIError, + XIVAPIInvalidAlgo +) diff --git a/pyxivapi/client.py b/pyxivapi/client.py index 4332851..fc55670 100644 --- a/pyxivapi/client.py +++ b/pyxivapi/client.py @@ -35,14 +35,12 @@ def __init__(self, api_key: str, session: Optional[ClientSession] = None) -> Non "match_phrase_prefix", "multi_match", "query_string" ] - @property def session(self) -> ClientSession: if self._session is None or self._session.closed: self._session = ClientSession() return self._session - @timed async def character_search(self, world, forename, surname, page=1): """|coro| @@ -62,7 +60,6 @@ async def character_search(self, world, forename, surname, page=1): async with self.session.get(url) as response: return await self.process_response(response) - @timed async def character_by_id(self, lodestone_id: int, extended=False, include_achievements=False, include_minions_mounts=False, include_classjobs=False, include_freecompany=False, include_freecompany_members=False, include_pvpteam=False, language="en"): """|coro| @@ -111,43 +108,6 @@ async def character_by_id(self, lodestone_id: int, extended=False, include_achie async with self.session.get(url, params=params) as response: return await self.process_response(response) - - @timed - async def character_verify(self, lodestone_id: int, token): - """|coro| - Request character data from XIVAPI.com - Parameters - ------------ - lodestone_id: int - The character's Lodestone ID. - token: str - The string token on a character's Lodestone profile to test against - """ - - params = { - "private_key": self.api_key, - "token": token - } - - url = f'{self.base_url}/character/{lodestone_id}/verification' - async with self.session.get(url, params=params) as response: - return await self.process_response(response) - - - @timed - async def character_update(self, lodestone_id: int): - """|coro| - Request a character to be updated as soon as possible - Parameters - ------------ - lodestone_id: int - The character's Lodestone ID. - """ - url = f'{self.base_url}/character/{lodestone_id}/update?private_key={self.api_key}' - async with self.session.get(url) as response: - return await self.process_response(response) - - @timed async def freecompany_search(self, world, name, page=1): """|coro| @@ -165,7 +125,6 @@ async def freecompany_search(self, world, name, page=1): async with self.session.get(url) as response: return await self.process_response(response) - @timed async def freecompany_by_id(self, lodestone_id: int, extended=False, include_freecompany_members=False): """|coro| @@ -195,7 +154,6 @@ async def freecompany_by_id(self, lodestone_id: int, extended=False, include_fre async with self.session.get(url, params=params) as response: return await self.process_response(response) - @timed async def linkshell_search(self, world, name, page=1): """|coro| @@ -213,7 +171,6 @@ async def linkshell_search(self, world, name, page=1): async with self.session.get(url) as response: return await self.process_response(response) - @timed async def linkshell_by_id(self, lodestone_id: int): """|coro| @@ -227,7 +184,6 @@ async def linkshell_by_id(self, lodestone_id: int): async with self.session.get(url) as response: return await self.process_response(response) - @timed async def pvpteam_search(self, world, name, page=1): """|coro| @@ -245,7 +201,6 @@ async def pvpteam_search(self, world, name, page=1): async with self.session.get(url) as response: return await self.process_response(response) - @timed async def pvpteam_by_id(self, lodestone_id): """|coro| @@ -259,9 +214,8 @@ async def pvpteam_by_id(self, lodestone_id): async with self.session.get(url) as response: return await self.process_response(response) - @timed - async def index_search(self, name, indexes=(), columns=(), filters: List[Filter]=(), sort: Sort=None, page=1, language="en", string_algo="match"): + async def index_search(self, name, indexes=(), columns=(), filters: List[Filter] = (), sort: Sort = None, page=1, language="en", string_algo="match"): """|coro| Search for data from on specific indexes. Parameters @@ -375,7 +329,6 @@ async def index_search(self, name, indexes=(), columns=(), filters: List[Filter] async with self.session.post(url, json=body) as response: return await self.process_response(response) - @timed async def index_by_id(self, index, content_id: int, columns=(), language="en"): """|coro| @@ -433,7 +386,6 @@ async def lore_search(self, query, language="en"): async with self.session.get(url, params=params) as response: return await self.process_response(response) - @timed async def lodestone_all(self): """|coro| @@ -444,7 +396,6 @@ async def lodestone_all(self): async with self.session.get(url) as response: return await self.process_response(response) - @timed async def lodestone_news(self): """|coro| @@ -454,7 +405,6 @@ async def lodestone_news(self): async with self.session.get(url) as response: return await self.process_response(response) - @timed async def lodestone_notices(self): """|coro| @@ -464,7 +414,6 @@ async def lodestone_notices(self): async with self.session.get(url) as response: return await self.process_response(response) - @timed async def lodestone_maintenance(self): """|coro| @@ -474,7 +423,6 @@ async def lodestone_maintenance(self): async with self.session.get(url) as response: return await self.process_response(response) - @timed async def lodestone_updates(self): """|coro| @@ -484,7 +432,6 @@ async def lodestone_updates(self): async with self.session.get(url) as response: return await self.process_response(response) - @timed async def lodestone_worldstatus(self): """|coro| @@ -494,7 +441,6 @@ async def lodestone_worldstatus(self): async with self.session.get(url) as response: return await self.process_response(response) - @timed async def lodestone_devblog(self): """|coro| @@ -504,7 +450,6 @@ async def lodestone_devblog(self): async with self.session.get(url) as response: return await self.process_response(response) - @timed async def lodestone_devposts(self): """|coro| @@ -514,7 +459,6 @@ async def lodestone_devposts(self): async with self.session.get(url) as response: return await self.process_response(response) - @timed async def lodestone_deepdungeon(self): """|coro| @@ -524,7 +468,6 @@ async def lodestone_deepdungeon(self): async with self.session.get(url) as response: return await self.process_response(response) - @timed async def lodestone_feasts(self): """|coro| @@ -534,7 +477,6 @@ async def lodestone_feasts(self): async with self.session.get(url) as response: return await self.process_response(response) - async def process_response(self, response): __log__.info(f'{response.status} from {response.url}') diff --git a/pyxivapi/models.py b/pyxivapi/models.py index 0e1b873..36653b3 100644 --- a/pyxivapi/models.py +++ b/pyxivapi/models.py @@ -1,5 +1,6 @@ from .exceptions import XIVAPIInvalidFilter + class Filter: """ Model class for DQL filters