async def api_postcode(request):
postcode: Optional[str] = request.match_info.get('<STR_LIT>', None)<EOL>try:<EOL><INDENT>coroutine = get_postcode_random() if postcode == "<STR_LIT>" else get_postcode(postcode)<EOL>postcode: Optional[Postcode] = await coroutine<EOL><DEDENT>except CachingError as e:<EOL><INDENT>return web.HTTPInternalServerError(body=e.status)<EOL><DEDENT>except CircuitBreakerError as e:<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>if postcode is not None:<EOL><INDENT>return str_json_response(postcode.serialize())<EOL><DEDENT>else:<EOL><INDENT>return web.HTTPNotFound(body="<STR_LIT>")<EOL><DEDENT><DEDENT>
Gets data from a postcode.
:param request: The aiohttp request.