Skip to content

Commit

Permalink
staticmethod
Browse files Browse the repository at this point in the history
  • Loading branch information
yjqiang committed Apr 16, 2019
1 parent 518e189 commit 228899c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions web_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 228899c

Please sign in to comment.