bugfix
This commit is contained in:
parent
e617645b03
commit
9581c2a8b3
@ -17,7 +17,7 @@ def string_template_render(tmplstr, data):
|
||||
return te.renders(tmplstr, data)
|
||||
|
||||
class MyTemplateEngine:
|
||||
def __init__(self,pathList,file_coding='utf-8',out_coding='utf-8', env={}):
|
||||
def __init__(self,pathList,file_coding='utf-8',out_coding='utf-8', env={}, enable_async=False):
|
||||
self.file_coding = file_coding
|
||||
self.out_coding = out_coding
|
||||
loader = FileSystemLoader(pathList, encoding=self.file_coding)
|
||||
|
||||
@ -155,9 +155,16 @@ class StreamHttpClient:
|
||||
req_args["data"] = data
|
||||
|
||||
async with session.request(method, url, **req_args) as response:
|
||||
response.raise_for_status()
|
||||
async for chunk in response.content.iter_chunked(chunk_size):
|
||||
yield chunk
|
||||
try:
|
||||
response.raise_for_status()
|
||||
async for chunk in response.content.iter_chunked(chunk_size):
|
||||
yield chunk
|
||||
except aiohttp.ClientResponseError as e:
|
||||
debug(f'❌ HTTP {response.status}: {response.reason}, {response.text()}"
|
||||
raise e
|
||||
except Exception as e:
|
||||
debug(f'❌ HTTP {response.status}: {response.reason}"
|
||||
raise e
|
||||
|
||||
if __name__ == '__main__':
|
||||
import asyncio
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user