From 228899cf01e078fd84538682441c8f57aec11762 Mon Sep 17 00:00:00 2001 From: yjqiang Date: Tue, 16 Apr 2019 22:43:58 +0800 Subject: [PATCH] staticmethod --- web_session.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/web_session.py b/web_session.py index a25d2a3..6cb758a 100644 --- a/web_session.py +++ b/web_session.py @@ -12,15 +12,18 @@ class WebSession: def __init__(self): self.var_session = aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=4)) - async def __get_json_body(self, rsp): + @staticmethod + async def __get_json_body(rsp): json_body = await rsp.json(content_type=None) return json_body - async def __get_text_body(self, rsp): + @staticmethod + async def __get_text_body(rsp): text = await rsp.text() return text - async def __get_binary_body(self, rsp): + @staticmethod + async def __get_binary_body(rsp): return await rsp.read() # method 类似于aiohttp里面的对应method,目前只支持GET、POST