[F] Move sendRequest to utils to avoid circular import

This commit is contained in:
Hykilpikonna
2020-11-27 09:31:48 -05:00
parent ea95450333
commit 65cb1a8842
3 changed files with 13 additions and 13 deletions
+10
View File
@@ -1,3 +1,4 @@
import difflib
import json
import textwrap
from urllib.parse import unquote
@@ -96,3 +97,12 @@ def render(message):
def wrap(string: str):
return '\n'.join(['\n '.join(textwrap.wrap(line, 120)) for line in string.splitlines()])
def sendRequest(req):
response = create(req)
text = response.text
if response.headers['Content-Type'] == 'application/json':
text = dictToString(json.loads(text))
response.close()
return text