Skip to content

Commit

Permalink
Merge pull request #9 from xivapi/remove-verify
Browse files Browse the repository at this point in the history
Remove Verify & update endpoints
  • Loading branch information
Yandawl authored Nov 18, 2020
2 parents 1e1a1ff + ddeb230 commit c439782
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 63 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,5 @@ example.py

# pycharm
.idea

.vscode
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ pip install pyxivapi

* /character/search
* /character/id
* /character/verify
* /character/update
* /freecompany/search
* /freecompany/id
* /linkshell/search
Expand Down
17 changes: 15 additions & 2 deletions pyxivapi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
60 changes: 1 addition & 59 deletions pyxivapi/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand All @@ -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|
Expand Down Expand Up @@ -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|
Expand All @@ -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|
Expand Down Expand Up @@ -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|
Expand All @@ -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|
Expand All @@ -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|
Expand All @@ -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|
Expand All @@ -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
Expand Down Expand Up @@ -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|
Expand Down Expand Up @@ -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|
Expand All @@ -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|
Expand All @@ -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|
Expand All @@ -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|
Expand All @@ -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|
Expand All @@ -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|
Expand All @@ -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|
Expand All @@ -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|
Expand All @@ -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|
Expand All @@ -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|
Expand All @@ -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}')

Expand Down
1 change: 1 addition & 0 deletions pyxivapi/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from .exceptions import XIVAPIInvalidFilter


class Filter:
"""
Model class for DQL filters
Expand Down

0 comments on commit c439782

Please sign in to comment.