requests.exceptions.ConnectionError: HTTPSConnectionPool(host='sysearch-propsamc.squareyards.com', port=443): Max retries exceeded with url: /zone-matrix/open/city-list/v1.0/read?country=CANADA (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f4788d509a0>: Failed to establish a new connection: [Errno 24] Too many open files'))
_new_conn
if self.socket_options:
extra_kw["socket_options"] = self.socket_options
try:
conn = connection.create_connection(
(self._dns_host, self.port), self.timeout, **extra_kw
)
except SocketTimeout:
raise ConnectTimeoutError(
create_connection
except UnicodeError:
return six.raise_from(
LocationParseError(u"'%s', label empty or too long" % host), None
)
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
af, socktype, proto, canonname, sa = res
sock = None
try:
sock = socket.socket(af, socktype, proto)
getaddrinfo
these arguments selects the full range of results.
"""
# We override this function since we want to translate the numeric family
# and socket type values to enum constants.
addrlist = []
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
af, socktype, proto, canonname, sa = res
addrlist.append((_intenum_converter(af, AddressFamily),
_intenum_converter(socktype, SocketKind),
proto, canonname, sa))
return addrlist
urlopen
)
if is_new_proxy_conn and http_tunnel_required:
self._prepare_proxy(conn)
# Make the request on the httplib connection object.
httplib_response = self._make_request(
conn,
method,
url,
timeout=timeout_obj,
body=body,
_make_request
timeout_obj.start_connect()
conn.timeout = timeout_obj.connect_timeout
# Trigger any extra validation we need to do.
try:
self._validate_conn(conn)
except (SocketTimeout, BaseSSLError) as e:
# Py2 raises this as a BaseSSLError, Py3 raises it as socket timeout.
self._raise_timeout(err=e, url=url, timeout_value=conn.timeout)
raise
_validate_conn
"""
super(HTTPSConnectionPool, self)._validate_conn(conn)
# Force connect early to allow us to validate the connection.
if not getattr(conn, "sock", None): # AppEngine might not have `.sock`
conn.connect()
if not conn.is_verified:
warnings.warn(
(
"Unverified HTTPS request is being made to host '%s'. "
connect
self.ca_cert_dir = ca_cert_dir and os.path.expanduser(ca_cert_dir)
self.ca_cert_data = ca_cert_data
def connect(self):
# Add certificate verification
self.sock = conn = self._new_conn()
hostname = self.host
tls_in_tls = False
if self._is_using_tunnel():
if self.tls_in_tls_required:
_new_conn
"Connection to %s timed out. (connect timeout=%s)"
% (self.host, self.timeout),
)
except SocketError as e:
raise NewConnectionError(
self, "Failed to establish a new connection: %s" % e
)
return conn
send
else:
timeout = TimeoutSauce(connect=timeout, read=timeout)
try:
if not chunked:
resp = conn.urlopen(
method=request.method,
url=url,
body=request.body,
headers=request.headers,
redirect=False,
urlopen
elif isinstance(e, (SocketError, NewConnectionError)) and self.proxy:
e = ProxyError("Cannot connect to proxy.", e)
elif isinstance(e, (SocketError, HTTPException)):
e = ProtocolError("Connection aborted.", e)
retries = retries.increment(
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
)
retries.sleep()
# Keep track of the error for the retry warning.
increment
other=other,
history=history,
)
if new_retry.is_exhausted():
raise MaxRetryError(_pool, url, error or ResponseError(cause))
log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)
return new_retry
full_dispatch_request
try:
request_started.send(self)
rv = self.preprocess_request()
if rv is None:
rv = self.dispatch_request()
except Exception as e:
rv = self.handle_user_exception(e)
return self.finalize_request(rv)
def finalize_request(
dispatch_request
and req.method == "OPTIONS"
):
return self.make_default_options_response()
# otherwise dispatch to the handler for that endpoint
view_args: t.Dict[str, t.Any] = req.view_args # type: ignore[assignment]
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
def full_dispatch_request(self) -> Response:
"""Dispatches the request and on top of that performs request
pre and postprocessing as well as HTTP exception catching and
error handling.
newDseRoute
# print(muncipalityData)
data = detailPageFuncCall(breadcrumbs)
total_time = datetime.now() - start
# data['propertyDetails']['Broker'] = data['propertyDetails']['Broker'].capitalize()
if data["status"]:
return render_template('detailPage/projectDetail.html', title=data["title"],
propertyDetails=data['propertyDetails'], propertiesLocations=data['propertiesLocations'],
breadcrumbs=data['breadcrumbs'], pageSlug=data['pageSlug'], comparableProperty=data['comparableProperty'],
ratingOfProperty=data['ratingOfProperty'], priceHistory=data['priceHistory'],
priceDiffrance=data['priceDiffrance'], pageMetaData=data['pageMetaData'], total_time=total_time,
similarListings=data['similarListings'],propertyTypeListing=data['propertyTypeListing'],typeofProperties=typeofProperties, tablet=tablet, mobile=mobile, neighbourUrl=neighbourUrl, final_data=final_data, urlCommunity=urlCommunity,quickLinksDataArray=muncipalityDataArray, quickLinksData=muncipalityData
render_template
a list is given, the first name to exist will be rendered.
:param context: The variables to make available in the template.
"""
app = current_app._get_current_object() # type: ignore[attr-defined]
template = app.jinja_env.get_or_select_template(template_name_or_list)
return _render(app, template, context)
def render_template_string(source: str, **context: t.Any) -> str:
"""Render a template from the given source string with the given
context.
_render
def _render(app: "Flask", template: Template, context: t.Dict[str, t.Any]) -> str:
app.update_template_context(context)
before_render_template.send(app, template=template, context=context)
rv = template.render(context)
template_rendered.send(app, template=template, context=context)
return rv
def render_template(
render
ctx = self.new_context(dict(*args, **kwargs))
try:
return self.environment.concat(self.root_render_func(ctx)) # type: ignore
except Exception:
self.environment.handle_exception()
async def render_async(self, *args: t.Any, **kwargs: t.Any) -> str:
"""This works similar to :meth:`render` but returns a coroutine
that when awaited returns the entire rendered template string. This
requires the async feature to be enabled.
handle_exception
"""Exception handling helper. This is used internally to either raise
rewritten exceptions or return a rendered traceback for the template.
"""
from .debug import rewrite_traceback_stack
raise rewrite_traceback_stack(source=source)
def join_path(self, template: str, parent: str) -> str:
"""Join a template with the parent. By default all the lookups are
relative to the loader root so this method returns the `template`
parameter unchanged, but if the paths should be relative to the
top-level template code
{% extends 'layout/newLayout.html' %}
{%block metaContent%}
<meta name="referrer" content="strict-origin-when-cross-origin" />
<meta name="description" content="{{pageMetaData['description']}}">
{% if request.MOBILE %}
<link rel="preload" href="{{S3_URL_MOBILE_DETAIL}}{{imageHash(propertyDetails.images[0]['s3_img_path']) if 'images' in propertyDetails and propertyDetails.images != None and propertyDetails.images|length > 0 else ''}}?aio=w-415;h-250;crop;" as="image">
top-level template code
{%endif%}
{% block topStyles %} {% endblock %}
{% block topJavascripts%} {%endblock%}
</head>
<body>
<div class="overlay"></div><div class="navOverlay"></div> {% include "element/header.html" %} {% block header %} {% endblock %} {% block content %} {% endblock %}
{% if request.MOBILE%}
<div class="bottomNavigation">
{% if (finalDataArray and 'urlSearchData' in finalDataArray and finalDataArray['urlSearchData']['area'] != ''
and finalDataArray['urlSearchData']['area'] != undefined) or ("project_city" in getDetail and
getDetail['project_city']!='') or (area != undefined and area != '' and area != 'ontario') or
top-level template code
{% block header %}
<header>
{%set areaWithIcon = ['Toronto', 'York', 'Peel', 'Durham', 'Halton', 'Hamilton', 'Simcoe', 'Wellington', 'Dufferin', 'Niagara', 'Waterloo', 'Ottawa'] %}
{%if pageSlug == "homePage"%}
{%set headerAreas = getHeaderAreaList('Sale')%}
{%elif pageSlug == "newProjectListing"%}
block 'header'
</div>
</nav>
{%if 'area' in session and session['area'] != ''%}
{%set di_area = session['area']%}
{%else%}{%set di_area="toronto"%}{%endif%}
{% set di_area = getDiHeaderCity(di_area)%}
<div class="btn dataIntelligenceBtn onclickByClass" data-url="{{BASE_URL}}/housing-market/on-{{di_area}}"> <span>Data</span>Intelligence</div>
{%endif%}
{% else %}
{% if request.MOBILE%}
getDiHeaderCity
area_list.append({"url": i["url"], "name": i["name"]})
return {"allArea": area_list}
def getDiHeaderCity(self, area):
if os.getenv('ENVIRONMENT') == "production":
city_list = requests.get(os.getenv('DATAINTELLIGENCE_CITY_LIST')).json()
else:
city_list = {"code":200,"status":"OK","result":{"city":["Brant","Brantford","Chatham-Kent","Dufferin","Durham","Greater Sudbur","Grey County","Haldimand","Halton","Hamilton","Kawartha Lakes","Norfolk","Northumberland","Ottawa","Peel","Peterborough","Simcoe","Toronto","Wellington","York"]}}
if 'result' in city_list and 'city' in city_list['result']:
city_list = city_list['result']['city']
if area.title() in city_list or area.title().replace('-', ' ') in city_list:
get
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
return request("get", url, params=params, **kwargs)
def options(url, **kwargs):
r"""Sends an OPTIONS request.
request
# By using the 'with' statement we are sure the session is closed, thus we
# avoid leaving sockets open which can trigger a ResourceWarning in some
# cases, and look like a memory leak in others.
with sessions.Session() as session:
return session.request(method=method, url=url, **kwargs)
def get(url, params=None, **kwargs):
r"""Sends a GET request.
request
send_kwargs = {
"timeout": timeout,
"allow_redirects": allow_redirects,
}
send_kwargs.update(settings)
resp = self.send(prep, **send_kwargs)
return resp
def get(self, url, **kwargs):
r"""Sends a GET request. Returns :class:`Response` object.
send
# Start time (approximately) of the request
start = preferred_clock()
# Send the request
r = adapter.send(request, **kwargs)
# Total elapsed time of the request (approximately)
elapsed = preferred_clock() - start
r.elapsed = timedelta(seconds=elapsed)
send
if isinstance(e.reason, _SSLError):
# This branch is for urllib3 v1.22 and later.
raise SSLError(e, request=request)
raise ConnectionError(e, request=request)
except ClosedPoolError as e:
raise ConnectionError(e, request=request)
except _ProxyError as e:
_new_conn
if self.socket_options:
extra_kw["socket_options"] = self.socket_options
try:
conn = connection.create_connection(
(self._dns_host, self.port), self.timeout, **extra_kw
)
except SocketTimeout:
raise ConnectTimeoutError(
create_connection
if sock is not None:
sock.close()
sock = None
if err is not None:
raise err
raise socket.error("getaddrinfo returns an empty list")
def _set_socket_options(sock, options):
create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
af, socktype, proto, canonname, sa = res
sock = None
try:
sock = socket.socket(af, socktype, proto)
# If provided, set socket level options before connecting.
_set_socket_options(sock, socket_options)
if timeout is not socket._GLOBAL_DEFAULT_TIMEOUT:
__init__
family = AF_INET
if type == -1:
type = SOCK_STREAM
if proto == -1:
proto = 0
_socket.socket.__init__(self, family, type, proto, fileno)
self._io_refs = 0
self._closed = False
def __enter__(self):
return self
urlopen
)
if is_new_proxy_conn and http_tunnel_required:
self._prepare_proxy(conn)
# Make the request on the httplib connection object.
httplib_response = self._make_request(
conn,
method,
url,
timeout=timeout_obj,
body=body,
_make_request
timeout_obj.start_connect()
conn.timeout = timeout_obj.connect_timeout
# Trigger any extra validation we need to do.
try:
self._validate_conn(conn)
except (SocketTimeout, BaseSSLError) as e:
# Py2 raises this as a BaseSSLError, Py3 raises it as socket timeout.
self._raise_timeout(err=e, url=url, timeout_value=conn.timeout)
raise
_validate_conn
"""
super(HTTPSConnectionPool, self)._validate_conn(conn)
# Force connect early to allow us to validate the connection.
if not getattr(conn, "sock", None): # AppEngine might not have `.sock`
conn.connect()
if not conn.is_verified:
warnings.warn(
(
"Unverified HTTPS request is being made to host '%s'. "
connect
self.ca_cert_dir = ca_cert_dir and os.path.expanduser(ca_cert_dir)
self.ca_cert_data = ca_cert_data
def connect(self):
# Add certificate verification
self.sock = conn = self._new_conn()
hostname = self.host
tls_in_tls = False
if self._is_using_tunnel():
if self.tls_in_tls_required:
_new_conn
"Connection to %s timed out. (connect timeout=%s)"
% (self.host, self.timeout),
)
except SocketError as e:
raise NewConnectionError(
self, "Failed to establish a new connection: %s" % e
)
return conn
send
else:
timeout = TimeoutSauce(connect=timeout, read=timeout)
try:
if not chunked:
resp = conn.urlopen(
method=request.method,
url=url,
body=request.body,
headers=request.headers,
redirect=False,
urlopen
elif isinstance(e, (SocketError, NewConnectionError)) and self.proxy:
e = ProxyError("Cannot connect to proxy.", e)
elif isinstance(e, (SocketError, HTTPException)):
e = ProtocolError("Connection aborted.", e)
retries = retries.increment(
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
)
retries.sleep()
# Keep track of the error for the retry warning.
increment
other=other,
history=history,
)
if new_retry.is_exhausted():
raise MaxRetryError(_pool, url, error or ResponseError(cause))
log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)
return new_retry
__call__
def __call__(self, environ: dict, start_response: t.Callable) -> t.Any:
"""The WSGI server calls the Flask application object as the
WSGI application. This calls :meth:`wsgi_app`, which can be
wrapped to apply middleware.
"""
return self.wsgi_app(environ, start_response)
wsgi_app
try:
ctx.push()
response = self.full_dispatch_request()
except Exception as e:
error = e
response = self.handle_exception(e)
except: # noqa: B001
error = sys.exc_info()[1]
raise
return response(environ, start_response)
finally:
wsgi_app
ctx = self.request_context(environ)
error: t.Optional[BaseException] = None
try:
try:
ctx.push()
response = self.full_dispatch_request()
except Exception as e:
error = e
response = self.handle_exception(e)
except: # noqa: B001
error = sys.exc_info()[1]
full_dispatch_request
request_started.send(self)
rv = self.preprocess_request()
if rv is None:
rv = self.dispatch_request()
except Exception as e:
rv = self.handle_user_exception(e)
return self.finalize_request(rv)
def finalize_request(
self,
rv: t.Union[ft.ResponseReturnValue, HTTPException],
handle_user_exception
handler = self._find_error_handler(e)
if handler is None:
raise
return self.ensure_sync(handler)(e)
def handle_exception(self, e: Exception) -> Response:
"""Handle an exception that did not have an error handler
associated with it, or that was raised from an error handler.
This always causes a 500 ``InternalServerError``.
error_handler
if os.getenv('ENVIRONMENT') == "production":
@app.errorhandler(Exception)
def error_handler(e):
return render_template("errorPages/404.html"), 404
@app.route('/api/customPanel',methods=['GET','POST'])
def SeoPanel():
render_template
a list is given, the first name to exist will be rendered.
:param context: The variables to make available in the template.
"""
app = current_app._get_current_object() # type: ignore[attr-defined]
template = app.jinja_env.get_or_select_template(template_name_or_list)
return _render(app, template, context)
def render_template_string(source: str, **context: t.Any) -> str:
"""Render a template from the given source string with the given
context.
_render
def _render(app: "Flask", template: Template, context: t.Dict[str, t.Any]) -> str:
app.update_template_context(context)
before_render_template.send(app, template=template, context=context)
rv = template.render(context)
template_rendered.send(app, template=template, context=context)
return rv
def render_template(
render
ctx = self.new_context(dict(*args, **kwargs))
try:
return self.environment.concat(self.root_render_func(ctx)) # type: ignore
except Exception:
self.environment.handle_exception()
async def render_async(self, *args: t.Any, **kwargs: t.Any) -> str:
"""This works similar to :meth:`render` but returns a coroutine
that when awaited returns the entire rendered template string. This
requires the async feature to be enabled.
handle_exception
"""Exception handling helper. This is used internally to either raise
rewritten exceptions or return a rendered traceback for the template.
"""
from .debug import rewrite_traceback_stack
raise rewrite_traceback_stack(source=source)
def join_path(self, template: str, parent: str) -> str:
"""Join a template with the parent. By default all the lookups are
relative to the loader root so this method returns the `template`
parameter unchanged, but if the paths should be relative to the
top-level template code
{% extends 'layout/newLayout.html' %}
{% block content %}
<style>
.webHide{display:none}
.mobHide{display:block}
top-level template code
{%endif%}
{% block topStyles %} {% endblock %}
{% block topJavascripts%} {%endblock%}
</head>
<body>
<div class="overlay"></div><div class="navOverlay"></div> {% include "element/header.html" %} {% block header %} {% endblock %} {% block content %} {% endblock %}
{% if request.MOBILE%}
<div class="bottomNavigation">
{% if (finalDataArray and 'urlSearchData' in finalDataArray and finalDataArray['urlSearchData']['area'] != ''
and finalDataArray['urlSearchData']['area'] != undefined) or ("project_city" in getDetail and
getDetail['project_city']!='') or (area != undefined and area != '' and area != 'ontario') or
top-level template code
{% block header %}
<header>
{%set areaWithIcon = ['Toronto', 'York', 'Peel', 'Durham', 'Halton', 'Hamilton', 'Simcoe', 'Wellington', 'Dufferin', 'Niagara', 'Waterloo', 'Ottawa'] %}
{%if pageSlug == "homePage"%}
{%set headerAreas = getHeaderAreaList('Sale')%}
{%elif pageSlug == "newProjectListing"%}
block 'header'
</div>
</nav>
{%if 'area' in session and session['area'] != ''%}
{%set di_area = session['area']%}
{%else%}{%set di_area="toronto" %}{%endif%}
{% set di_area = getDiHeaderCity(di_area)%}
{% if not request.MOBILE%}<div class="btn dataIntelligenceBtn onclickByClass" data-url="{{BASE_URL}}/housing-market/on-{{di_area}}"> <span>Data</span>Intelligence</div>{%endif%}
{% endif %}
<div class="btnSection"> <a href="{{BASE_URL}}/listyourProperty" class="btn postBtn" id="postProperty">Sell Your Home</a>
{% if not request.MOBILE%}
getDiHeaderCity
area_list.append({"url": i["url"], "name": i["name"]})
return {"allArea": area_list}
def getDiHeaderCity(self, area):
if os.getenv('ENVIRONMENT') == "production":
city_list = requests.get(os.getenv('DATAINTELLIGENCE_CITY_LIST')).json()
else:
city_list = {"code":200,"status":"OK","result":{"city":["Brant","Brantford","Chatham-Kent","Dufferin","Durham","Greater Sudbur","Grey County","Haldimand","Halton","Hamilton","Kawartha Lakes","Norfolk","Northumberland","Ottawa","Peel","Peterborough","Simcoe","Toronto","Wellington","York"]}}
if 'result' in city_list and 'city' in city_list['result']:
city_list = city_list['result']['city']
if area.title() in city_list or area.title().replace('-', ' ') in city_list:
get
:param \*\*kwargs: Optional arguments that ``request`` takes.
:return: :class:`Response <Response>` object
:rtype: requests.Response
"""
return request("get", url, params=params, **kwargs)
def options(url, **kwargs):
r"""Sends an OPTIONS request.
request
# By using the 'with' statement we are sure the session is closed, thus we
# avoid leaving sockets open which can trigger a ResourceWarning in some
# cases, and look like a memory leak in others.
with sessions.Session() as session:
return session.request(method=method, url=url, **kwargs)
def get(url, params=None, **kwargs):
r"""Sends a GET request.
request
send_kwargs = {
"timeout": timeout,
"allow_redirects": allow_redirects,
}
send_kwargs.update(settings)
resp = self.send(prep, **send_kwargs)
return resp
def get(self, url, **kwargs):
r"""Sends a GET request. Returns :class:`Response` object.
send
# Start time (approximately) of the request
start = preferred_clock()
# Send the request
r = adapter.send(request, **kwargs)
# Total elapsed time of the request (approximately)
elapsed = preferred_clock() - start
r.elapsed = timedelta(seconds=elapsed)
send
if isinstance(e.reason, _SSLError):
# This branch is for urllib3 v1.22 and later.
raise SSLError(e, request=request)
raise ConnectionError(e, request=request)
except ClosedPoolError as e:
raise ConnectionError(e, request=request)
except _ProxyError as e:
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='sysearch-propsamc.squareyards.com', port=443): Max retries exceeded with url: /zone-matrix/open/city-list/v1.0/read?country=CANADA (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f4788d509a0>: Failed to establish a new connection: [Errno 24] Too many open files'))
This is the Copy/Paste friendly version of the traceback.
The console is locked and needs to be unlocked by entering the PIN. You can find the PIN printed out on the standard output of your shell that runs the server.