You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@app.route('/users/int:user_id/search', methods=["GET", "POST"])
@cross_origin()
def get_search_form(user_id):
""" Shows search form and process it """
user = User.query.get(user_id)
form = PlaceForm()
if form.validate_on_submit():
query = form.name.data
response = requests.get(f'{API_BASE_URL}/json?input={query}&inputtype=textquery&fields=place_id,name,formatted_address&key={key}')
data = response.json()
result = {
'name': data['candidates'][0]['name'],
'address': data['candidates'][0]['formatted_address'],
'place_id': data['candidates'][0]['place_id']
}
#print(result['name'])
place = Place(name=result['name'], address=result['address'], google_id=result['place_id'])
db.session.add(place)
try:
db.session.commit()
google = result['place_id']
time_resp = get_id(f"{key}", google)
today = datetime.datetime.today().weekday()
day = time_resp['populartimes'][today]['data'][datetime.datetime.now().hour]
wait_time = round(day / 2)
print('wait time', wait_time)
return render_template('/results.html', form=form, place=place, user=user, wait_time=wait_time, button="Search")
except:
print('hello**********************************************')
db.session.rollback()
return render_template('/results.html', form=form, place=place, user=user, button="Search")
else:
return render_template("/search_form.html", user=user, form=form, `button="Search")```
I can't get it to work on Heroku. Is there a solution to this error? thanks!
2021-06-03T16:52:39.456746+00:00 app[web.1]: 2021-06-03 16:52:39,456 INFO sqlalchemy.engine.base.Engine BEGIN (implicit)
2021-06-03T16:52:39.456758+00:00 app[web.1]: INFO:sqlalchemy.engine.base.Engine:BEGIN (implicit)
2021-06-03T16:52:39.457130+00:00 app[web.1]: 2021-06-03 16:52:39,457 INFO sqlalchemy.engine.base.Engine SELECT users.id AS users_id, users.email AS users_email, users.password AS users_password, users.first_name AS users_first_name, users.last_name AS users_last_name
2021-06-03T16:52:39.457132+00:00 app[web.1]: FROM users
2021-06-03T16:52:39.457133+00:00 app[web.1]: WHERE users.id = %(param_1)s
2021-06-03T16:52:39.457145+00:00 app[web.1]: INFO:sqlalchemy.engine.base.Engine:SELECT users.id AS users_id, users.email AS users_email, users.password AS users_password, users.first_name AS users_first_name, users.last_name AS users_last_name
2021-06-03T16:52:39.457145+00:00 app[web.1]: FROM users
2021-06-03T16:52:39.457145+00:00 app[web.1]: WHERE users.id = %(param_1)s
2021-06-03T16:52:39.457206+00:00 app[web.1]: 2021-06-03 16:52:39,457 INFO sqlalchemy.engine.base.Engine {'param_1': 3}
2021-06-03T16:52:39.457226+00:00 app[web.1]: INFO:sqlalchemy.engine.base.Engine:{'param_1': 3}
2021-06-03T16:52:39.991654+00:00 app[web.1]: 2021-06-03 16:52:39,991 INFO sqlalchemy.engine.base.Engine INSERT INTO places (name, google_id, address) VALUES (%(name)s, %(google_id)s, %(address)s) RETURNING places.id
2021-06-03T16:52:39.991668+00:00 app[web.1]: INFO:sqlalchemy.engine.base.Engine:INSERT INTO places (name, google_id, address) VALUES (%(name)s, %(google_id)s, %(address)s) RETURNING places.id
2021-06-03T16:52:39.991734+00:00 app[web.1]: 2021-06-03 16:52:39,991 INFO sqlalchemy.engine.base.Engine {'name': 'Metric Coffee', 'google_id': 'ChIJFe_FAUgtDogRNvsYZUbeFFk', 'address': '2021 W Fulton St suite k-101b, Chicago, IL 60612, United States'}
2021-06-03T16:52:39.991758+00:00 app[web.1]: INFO:sqlalchemy.engine.base.Engine:{'name': 'Metric Coffee', 'google_id': 'ChIJFe_FAUgtDogRNvsYZUbeFFk', 'address': '2021 W Fulton St suite k-101b, Chicago, IL 60612, United States'}
2021-06-03T16:52:39.992963+00:00 app[web.1]: 2021-06-03 16:52:39,992 INFO sqlalchemy.engine.base.Engine COMMIT
2021-06-03T16:52:39.992980+00:00 app[web.1]: INFO:sqlalchemy.engine.base.Engine:COMMIT
2021-06-03T16:52:40.171389+00:00 app[web.1]: ERROR:app:Exception on /users/3/search [POST]
2021-06-03T16:52:40.171390+00:00 app[web.1]: Traceback (most recent call last):
2021-06-03T16:52:40.171390+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/urllib/request.py", line 1342, in do_open
2021-06-03T16:52:40.171391+00:00 app[web.1]: h.request(req.get_method(), req.selector, req.data, headers,
2021-06-03T16:52:40.171391+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/http/client.py", line 1255, in request
2021-06-03T16:52:40.171394+00:00 app[web.1]: self._send_request(method, url, body, headers, encode_chunked)
2021-06-03T16:52:40.171394+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/http/client.py", line 1301, in _send_request
2021-06-03T16:52:40.171395+00:00 app[web.1]: self.endheaders(body, encode_chunked=encode_chunked)
2021-06-03T16:52:40.171395+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/http/client.py", line 1250, in endheaders
2021-06-03T16:52:40.171395+00:00 app[web.1]: self._send_output(message_body, encode_chunked=encode_chunked)
2021-06-03T16:52:40.171396+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/http/client.py", line 1010, in _send_output
2021-06-03T16:52:40.171397+00:00 app[web.1]: self.send(msg)
2021-06-03T16:52:40.171397+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/http/client.py", line 950, in send
2021-06-03T16:52:40.171397+00:00 app[web.1]: self.connect()
2021-06-03T16:52:40.171398+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/http/client.py", line 1424, in connect
2021-06-03T16:52:40.171398+00:00 app[web.1]: self.sock = self._context.wrap_socket(self.sock,
2021-06-03T16:52:40.171398+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/ssl.py", line 500, in wrap_socket
2021-06-03T16:52:40.171399+00:00 app[web.1]: return self.sslsocket_class._create(
2021-06-03T16:52:40.171399+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/ssl.py", line 1040, in _create
2021-06-03T16:52:40.171400+00:00 app[web.1]: self.do_handshake()
2021-06-03T16:52:40.171400+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/ssl.py", line 1309, in do_handshake
2021-06-03T16:52:40.171400+00:00 app[web.1]: self._sslobj.do_handshake()
2021-06-03T16:52:40.171401+00:00 app[web.1]: ssl.SSLError: [SSL] internal error (_ssl.c:1123)
2021-06-03T16:52:40.171402+00:00 app[web.1]:
2021-06-03T16:52:40.171402+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2021-06-03T16:52:40.171402+00:00 app[web.1]:
2021-06-03T16:52:40.171403+00:00 app[web.1]: Traceback (most recent call last):
2021-06-03T16:52:40.171403+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 2447, in wsgi_app
2021-06-03T16:52:40.171403+00:00 app[web.1]: response = self.full_dispatch_request()
2021-06-03T16:52:40.171404+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1952, in full_dispatch_request
2021-06-03T16:52:40.171404+00:00 app[web.1]: rv = self.handle_user_exception(e)
2021-06-03T16:52:40.171404+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1821, in handle_user_exception
2021-06-03T16:52:40.171405+00:00 app[web.1]: reraise(exc_type, exc_value, tb)
2021-06-03T16:52:40.171405+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/_compat.py", line 39, in reraise
2021-06-03T16:52:40.171405+00:00 app[web.1]: raise value
2021-06-03T16:52:40.171406+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1950, in full_dispatch_request
2021-06-03T16:52:40.171406+00:00 app[web.1]: rv = self.dispatch_request()
2021-06-03T16:52:40.171406+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/flask/app.py", line 1936, in dispatch_request
2021-06-03T16:52:40.171407+00:00 app[web.1]: return self.view_functionsrule.endpoint
2021-06-03T16:52:40.171407+00:00 app[web.1]: File "/app/app.py", line 127, in get_search_form
2021-06-03T16:52:40.171408+00:00 app[web.1]: time_resp = get_id(f"{key}", google)
2021-06-03T16:52:40.171408+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/populartimes/init.py", line 56, in get_id
2021-06-03T16:52:40.171408+00:00 app[web.1]: return get_populartimes(api_key, place_id)
2021-06-03T16:52:40.171408+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/populartimes/crawler.py", line 441, in get_populartimes
2021-06-03T16:52:40.171409+00:00 app[web.1]: return get_populartimes_by_detail(api_key, detail)
2021-06-03T16:52:40.171409+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/populartimes/crawler.py", line 455, in get_populartimes_by_detail
2021-06-03T16:52:40.171409+00:00 app[web.1]: detail_json = add_optional_parameters(detail_json, detail, *get_populartimes_from_search(
2021-06-03T16:52:40.171410+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/populartimes/crawler.py", line 365, in get_populartimes_from_search
2021-06-03T16:52:40.171410+00:00 app[web.1]: resp = urllib.request.urlopen(urllib.request.Request(url=search_url, data=None, headers=USER_AGENT),
2021-06-03T16:52:40.171410+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/urllib/request.py", line 214, in urlopen
2021-06-03T16:52:40.171410+00:00 app[web.1]: return opener.open(url, data, timeout)
2021-06-03T16:52:40.171411+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/urllib/request.py", line 517, in open
2021-06-03T16:52:40.171411+00:00 app[web.1]: response = self._open(req, data)
2021-06-03T16:52:40.171411+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/urllib/request.py", line 534, in _open
2021-06-03T16:52:40.171411+00:00 app[web.1]: result = self._call_chain(self.handle_open, protocol, protocol +
2021-06-03T16:52:40.171412+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/urllib/request.py", line 494, in _call_chain
2021-06-03T16:52:40.171412+00:00 app[web.1]: result = func(*args)
2021-06-03T16:52:40.171412+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/urllib/request.py", line 1385, in https_open
2021-06-03T16:52:40.171413+00:00 app[web.1]: return self.do_open(http.client.HTTPSConnection, req,
2021-06-03T16:52:40.171413+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/urllib/request.py", line 1345, in do_open
2021-06-03T16:52:40.171413+00:00 app[web.1]: raise URLError(err)
2021-06-03T16:52:40.171414+00:00 app[web.1]: urllib.error.URLError: <urlopen error [SSL] internal error (_ssl.c:1123)>
2021-06-03T16:52:40.171983+00:00 app[web.1]: 10.1.51.205 - - [03/Jun/2021:16:52:40 +0000] "POST /users/3/search?csrf_token=IjdkYzg3NTgzYTQzZTRhYjFiNzVlY2Q1YTcyZjg1Yjc0ZDE3MjRkNjAi.YLkHDQ.2jSyhzr5xEVSdVMUPe-QAV2Q39w HTTP/1.1" 500 290 "https://line-tracker-app.herokuapp.com/users/3/search?csrf_token=IjdkYzg3NTgzYTQzZTRhYjFiNzVlY2Q1YTcyZjg1Yjc0ZDE3MjRkNjAi.YLkHDQ.2jSyhzr5xEVSdVMUPe-QAV2Q39w" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:89.0) Gecko/20100101 Firefox/89.0"
2021-06-03T16:52:40.166051+00:00 heroku[router]: at=info method=POST path="/users/3/search?csrf_token=IjdkYzg3NTgzYTQzZTRhYjFiNzVlY2Q1YTcyZjg1Yjc0ZDE3MjRkNjAi.YLkHDQ.2jSyhzr5xEVSdVMUPe-QAV2Q39w" host=line-tracker-app.herokuapp.com request_id=db7777a7-a8d6-4ff2-aeba-4c48a8eb9250 fwd="45.51.175.171" dyno=web.1 connect=1ms service=717ms status=500 bytes=477 protocol=https
The text was updated successfully, but these errors were encountered: