|
@@ -3,7 +3,7 @@
|
|
|
"""
|
|
|
import json
|
|
|
|
|
|
-import requests
|
|
|
+import aiohttp
|
|
|
from applications.articleTools import ArticleDBTools
|
|
|
|
|
|
|
|
@@ -37,12 +37,18 @@ class AccountServer(object):
|
|
|
"symbol": 1,
|
|
|
},
|
|
|
"function": "similarities_cross_avg"
|
|
|
-
|
|
|
}
|
|
|
print(json.dumps(body, ensure_ascii=False, indent=4))
|
|
|
- response = requests.post(url=url, headers=headers, json=body)
|
|
|
- print(response.text)
|
|
|
- return response.json()
|
|
|
+
|
|
|
+ async with aiohttp.ClientSession() as session:
|
|
|
+ async with session.post(url, headers=headers, json=body) as response:
|
|
|
+ response_text = await response.text()
|
|
|
+ print("结果:\t", response_text)
|
|
|
+ if response_text:
|
|
|
+ return await response.json()
|
|
|
+ else:
|
|
|
+ print("Received empty response")
|
|
|
+ return {}
|
|
|
|
|
|
def checkParams(self):
|
|
|
"""
|