async def index(request):
async with aiohttp.ClientSession() as client:
data=await(email_verification(client))
await client.post('http://127.0.0.1:8000/acc/signup',data=data)
async def email_verification(client):
async with client.get('http://www.mocky.io/v2/5c18dfb62f00005b00af1241') as resp:
return await(resp.json())
but whenever i tried to acess the url i got this error
await resp.prepare(request)
AttributeError: 'NoneType' object has no attribute 'prepare'
i cant even understand what the issue is and where this resp.prepare came from please
Web-handler should return a response object, not None.
The fixed code is:
async def index(request):
async with aiohttp.ClientSession() as client:
data=await(email_verification(client))
await client.post('http://127.0.0.1:8000/acc/signup',data=data)
return web.Response(text="OK")
async def email_verification(client):
async with client.get('http://www.mocky.io/v2/5c18dfb62f00005b00af1241') as resp:
return await(resp.json())