mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-10 09:35:34 +00:00
Format project with black (#467)
Format with line length 110 to match flake8 make black part of linting check Update travis spec for updated black requirements Add diff output for black on failure update changelog
This commit is contained in:
@@ -5,19 +5,19 @@ import aiohttp
|
||||
from aiohttp.test_utils import TestClient
|
||||
|
||||
|
||||
async def aiohttp_request(loop, method, url, output='text', encoding='utf-8', content_type=None, **kwargs):
|
||||
async def aiohttp_request(loop, method, url, output="text", encoding="utf-8", content_type=None, **kwargs):
|
||||
session = aiohttp.ClientSession(loop=loop)
|
||||
response_ctx = session.request(method, url, **kwargs)
|
||||
|
||||
response = await response_ctx.__aenter__()
|
||||
if output == 'text':
|
||||
if output == "text":
|
||||
content = await response.text()
|
||||
elif output == 'json':
|
||||
content_type = content_type or 'application/json'
|
||||
elif output == "json":
|
||||
content_type = content_type or "application/json"
|
||||
content = await response.json(encoding=encoding, content_type=content_type)
|
||||
elif output == 'raw':
|
||||
elif output == "raw":
|
||||
content = await response.read()
|
||||
elif output == 'stream':
|
||||
elif output == "stream":
|
||||
content = await response.content.read()
|
||||
|
||||
response_ctx._resp.close()
|
||||
@@ -28,7 +28,7 @@ async def aiohttp_request(loop, method, url, output='text', encoding='utf-8', co
|
||||
|
||||
def aiohttp_app():
|
||||
async def hello(request):
|
||||
return aiohttp.web.Response(text='hello')
|
||||
return aiohttp.web.Response(text="hello")
|
||||
|
||||
async def json(request):
|
||||
return aiohttp.web.json_response({})
|
||||
@@ -37,7 +37,7 @@ def aiohttp_app():
|
||||
return aiohttp.web.json_response()
|
||||
|
||||
app = aiohttp.web.Application()
|
||||
app.router.add_get('/', hello)
|
||||
app.router.add_get('/json', json)
|
||||
app.router.add_get('/json/empty', json_empty_body)
|
||||
app.router.add_get("/", hello)
|
||||
app.router.add_get("/json", json)
|
||||
app.router.add_get("/json/empty", json_empty_body)
|
||||
return app
|
||||
|
||||
Reference in New Issue
Block a user