Delete obsolete source folder
This commit is contained in:
parent
a788bee25c
commit
8f32241191
@ -1,28 +0,0 @@
|
|||||||
import unittest
|
|
||||||
import asyncio
|
|
||||||
import worthless
|
|
||||||
client = worthless.Launcher()
|
|
||||||
|
|
||||||
|
|
||||||
class LauncherTest(unittest.TestCase):
|
|
||||||
def test_get_version_info(self):
|
|
||||||
version_info = asyncio.run(client.get_version_info())
|
|
||||||
print("get_version_info test.")
|
|
||||||
print("version_info: ", version_info)
|
|
||||||
self.assertIsInstance(version_info, dict)
|
|
||||||
|
|
||||||
def test_get_launcher_info(self):
|
|
||||||
launcher_info = asyncio.run(client.get_launcher_info())
|
|
||||||
print("get_launcher_info test.")
|
|
||||||
print("launcher_info: ", launcher_info)
|
|
||||||
self.assertIsInstance(launcher_info, dict)
|
|
||||||
|
|
||||||
def test_get_launcher_full_info(self):
|
|
||||||
launcher_info = asyncio.run(client.get_launcher_full_info())
|
|
||||||
print("get_launcher_full_info test.")
|
|
||||||
print("launcher_full_info: ", launcher_info)
|
|
||||||
self.assertIsInstance(launcher_info, dict)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
unittest.main()
|
|
@ -1,26 +0,0 @@
|
|||||||
import aiohttp
|
|
||||||
from worthless import constants
|
|
||||||
|
|
||||||
|
|
||||||
class Launcher:
|
|
||||||
def __init__(self):
|
|
||||||
self._api = constants.LAUNCHER_API_URL
|
|
||||||
|
|
||||||
# Workaround because miHoYo uses retcode for their API
|
|
||||||
@staticmethod
|
|
||||||
async def _get(url, **kwargs):
|
|
||||||
async with aiohttp.ClientSession() as session:
|
|
||||||
rsp = await session.get(url, **kwargs)
|
|
||||||
rsp_json = await rsp.json()
|
|
||||||
# Why retcode seriously? They can just make the page not returning 200 status code.
|
|
||||||
if rsp_json["retcode"] != 0:
|
|
||||||
raise aiohttp.ClientResponseError(code=rsp_json["retcode"],
|
|
||||||
message=rsp_json["message"],
|
|
||||||
history=rsp.history,
|
|
||||||
request_info=rsp.request_info)
|
|
||||||
return rsp_json
|
|
||||||
|
|
||||||
async def get_version_info(self):
|
|
||||||
rsp = await self._get(self._api + "/resource", params={"key": "gcStgarh",
|
|
||||||
"launcher_id": "10"})
|
|
||||||
return rsp
|
|
Loading…
Reference in New Issue
Block a user