Closed srikanthbojja closed 11 months ago
Thank you for reporting the urllib3.exceptions.NewConnectionError
issue. This error typically arises when a connection to the server cannot be established. I've attempted to replicate the issue on our end but was unable to reproduce the error, which suggests the issue might be environment-specific.
Since we host the server you are trying to connect to, I have also checked its status and it appears to be functioning as expected. Here are some troubleshooting steps that might help:
Network Connectivity:
Firewall/Security Settings:
Proxy Settings:
SDK Configuration:
Please follow up with any additional information or if there's more you can provide to help diagnose this issue. We appreciate your cooperation and patience as we work to resolve this.
Thank you!
@tokuhirom I hosted this bot server/webhook on pythonanywhere and a slightly different variation with the old API worked fine but when I tested the V3 flask-kitchen it gave me this error.
below is the old API code that worked:
from flask import Flask, request, abort
from linebot import LineBotApi, WebhookHandler
from linebot.models import MessageEvent, TextMessage, TextSendMessage
# Your Line API credentials
CHANNEL_SECRET = "xxxx"
CHANNEL_ACCESS_TOKEN = "xxxx"
# Initialize the LineBotApi and WebhookHandler
line_bot_api = LineBotApi(CHANNEL_ACCESS_TOKEN)
handler = WebhookHandler(CHANNEL_SECRET)
app = Flask(__name__)
@app.route("/callback", methods=["POST"])
def callback():
# Get the request body as text
body = request.get_data(as_text=True)
# Handle the Line event
try:
handler.handle(body, request.headers.get("X-Line-Signature", ""))
except Exception as e:
print(str(e))
abort(400)
return "OK"
@handler.add(MessageEvent, message=TextMessage)
def handle_message(event):
user_id = event.source.user_id
message_text = event.message.text
if message_text.lower() == "info":
# Get the user's profile
profile = line_bot_api.get_profile(user_id)
# Extract profile information
user_id = profile.user_id
display_name = profile.display_name
picture_url = profile.picture_url
status_message = profile.status_message
# Send the user's profile information as a message
response_message = f"User ID: {user_id}\nDisplay Name: {display_name}\n"
response_message += (
f"Profile Picture URL: {picture_url}\nStatus Message: {status_message}"
)
line_bot_api.reply_message(
event.reply_token, TextSendMessage(text=response_message)
)
if __name__ == "__main__":
app.run(debug=True)
hmm?
I can run my bot with linebot.v3
on my machine. Here's a code with linebot.v3
.
from flask import Flask, request, abort
from linebot.v3 import (
WebhookHandler
)
from linebot.v3.webhooks import (
MessageEvent,
TextMessageContent,
)
from linebot.v3.messaging import (
Configuration,
MessagingApi,
ReplyMessageRequest,
ApiClient,
TextMessage,
)
# Your Line API credentials
CHANNEL_SECRET = "xxxxx"
CHANNEL_ACCESS_TOKEN = "xxxxx"
# Initialize the LineBotApi and WebhookHandler
handler = WebhookHandler(CHANNEL_SECRET)
configuration = Configuration(
access_token=CHANNEL_ACCESS_TOKEN
)
app = Flask(__name__)
@app.route("/callback", methods=["POST"])
def callback():
# Get the request body as text
body = request.get_data(as_text=True)
# Handle the Line event
try:
handler.handle(body, request.headers.get("X-Line-Signature", ""))
except Exception as e:
print(str(e))
abort(400)
return "OK"
@handler.add(MessageEvent, message=TextMessageContent)
def handle_message(event):
user_id = event.source.user_id
message_text = event.message.text
with ApiClient(configuration) as api_client:
if message_text.lower() == "info":
line_bot_api = MessagingApi(api_client)
# Get the user's profile
profile = line_bot_api.get_profile(user_id)
# Extract profile information
user_id = profile.user_id
display_name = profile.display_name
picture_url = profile.picture_url
status_message = profile.status_message
# Send the user's profile information as a message
response_message = f"User ID: {user_id}\nDisplay Name: {display_name}\n"
response_message += (
f"Profile Picture URL: {picture_url}\nStatus Message: {status_message}"
)
line_bot_api.reply_message_with_http_info(
ReplyMessageRequest(
reply_token=event.reply_token,
messages=[TextMessage(text=response_message)]
)
)
if __name__ == "__main__":
app.run(debug=True)
@tokuhirom tried your version of the bot and gave me this error. May I know what Python version and package versions you used
2023-10-19 09:33:21,962: OSError: write error
2023-10-19 09:34:20,934: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fb1608726d0>: Failed to establish a new connection: [Errno 111] Connection refused')': /v2/bot/profile/U9e775e52373838c0aad2095a81fe3e14
2023-10-19 09:34:21,958: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fb160872820>: Failed to establish a new connection: [Errno 111] Connection refused')': /v2/bot/profile/U9e775e52373838c0aad2095a81fe3e14
2023-10-19 09:34:22,982: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fb160872970>: Failed to establish a new connection: [Errno 111] Connection refused')': /v2/bot/profile/U9e775e52373838c0aad2095a81fe3e14
By the way, what happens if you call the API with curl or other http client from your machine(or server) where you ran V3 flask-kitchen? We'd like to help you, but currently we can't produce your report.
@Yang-33 the webhook URL is receiving data from the bot
Request body: {"destination":"Ud2674e3166xxx","events":[{"type":"message","message":{"type":"text","id":"477953616574xx","quoteToken":"vV3CEteFTXi7C0x_ahndg1-iu8SIwkO0IA_yzF8-8oPlu9ZAi0h7kbK6PjFuLCUafLadES4BP6BTE8EtWGVtJKFWFx3z0YurEZq2m9B9EQTVq1V-xxx-OQ","text":"info"},"webhookEventId":"01HD3T3B2HAFZW4WYxxxx","deliveryContext":{"isRedelivery":false},"timestamp":1697713859533,"source":{"type":"user","userId":"U9e775e52373838c0aad209xxx"},"replyToken":"18e1cabafccb4ba8a3d61b22xxx","mode":"active"}]}
What happens when you run this code snippet?
import urllib3
http = urllib3.PoolManager()
r = http.request('GET', 'https://api.line.me/oauth2/v2.1/certs')
r.status
And this one.
import urllib3
urllib3.__version__
@be-hase
urllib3 version: 1.24.3
and the GETvrequest returns following error:
Hmmm. If you are getting errors with this basic code, then something is wrong with your environment.
@be-hase I hosted this app on pythonanywhere.com and it tunnels the free users through a proxy "allowlist"
are part of the allowlist, but still, I was not able to get traffic out even stranger thing is that the old API works but not the V3. Has something changed in V3?
According to https://help.pythonanywhere.com/pages/403ForbiddenError/,
or that it needs to be configured to use a proxy.
I'm not sure this is related to your question or not, but probably you need to add configuration to use the proxy...?
like
configuration = Configuration(
access_token=channel_access_token
)
configuration.proxy = "<PROXY_URL>"
@Yang-33
i tried
print(urllib3.__version__)
http = urllib3.ProxyManager('http://proxy.server:3128')
r = http.request('GET', 'https://api.line.me/oauth2/v2.1/certs')
print(r.__dict__)
and it returned
{'headers': HTTPHeaderDict({'Server': 'legy', 'Content-Type': 'application/json', 'x-content-type-options': 'nosniff', 'x-frame-options': 'DENY', 'x-line-request-id': 'ebfb57f40351e5d9', 'x-xss-protection': '1; mode=block', 'Content-Length': '6730', 'Expires': 'Fri, 20 Oct 2023 09:04:32 GMT', 'Cache-Control': 'max-age=0, no-cache, no-store', 'Pragma': 'no-cache', 'Date': 'Fri, 20 Oct 2023 09:04:32 GMT', 'Connection': 'keep-alive'}), 'status': 200, 'version': 11, 'reason': 'OK', 'strict': 0, 'decode_content': True, 'retries': Retry(total=3, connect=None, read=None, redirect=None, status=None), 'enforce_content_length': False, '_decoder': None, '_body': b'{"keys":[{"kty":"EC","alg":"ES256","use":"sig","kid":"26cf395f48162e4a377339b9520c706729e1fdc3a645b7a9ae77ac2a4875a808","crv":"P-256","x":"WNUVJVRIPUQCxRT1Glc9gluNUr202v_O2Lu2Bbr6TnQ","y":"JWGRxJjRszhP8Jukl7i5FctFG-_7tm0kQfiHDvOTe2o","xvalue":"WNUVJVRIPUQCxRT1Glc9gluNUr202v_O2Lu2Bbr6TnQ","yvalue":"JWGRxJjRszhP8Jukl7i5FctFG-_7tm0kQfiHDvOTe2o"},{"kty":"EC","alg":"ES256","use":"sig","kid":"e6a6919386169ba54de9dd336b41479a01012dc0c428baae2de18e59ee2146db","crv":"P-256","x":"zN32PhHKWQSRtCp2d8Yg9FxqOzAi1W7rrhpAQ3gfTvc","y":"zXsnhmFCH14mSKfwcz20FChj51pgIJA_szwATV--tMk","xvalue":"zN32PhHKWQSRtCp2d8Yg9FxqOzAi1W7rrhpAQ3gfTvc","yvalue":"zXsnhmFCH14mSKfwcz20FChj51pgIJA_szwATV--tMk"},{"kty":"EC","alg":"ES256","use":"sig","kid":"a2a459aec5b65fa4e8add5c7697c79be445ae312bbcd6eef8fe09b5bb826cf3d","crv":"P-256","x":"jjZwXh2JwJfijLa6JVPgyo44uQvubKa1gsGNEl54OLQ","y":"VEKaDMTi5IfeGSsjKzQm-USL-8Pj0q65_ns5sYkyU4A","xvalue":"jjZwXh2JwJfijLa6JVPgyo44uQvubKa1gsGNEl54OLQ","yvalue":"VEKaDMTi5IfeGSsjKzQm-USL-8Pj0q65_ns5sYkyU4A"},{"kty":"EC","alg":"ES256","use":"sig","kid":"ccd58c2f2646f45fe0b4bbb0237d62f0dd7bb1669d40c121b8488f10bf363900","crv":"P-256","x":"anx78hv9GNYhR4FVp_kJXzb4iF4DaO65JYoGfUOR4tY","y":"SGFzUbQBGrjYfewdGHdkbp8SSi83hg9FnilgmTam0n4","xvalue":"anx78hv9GNYhR4FVp_kJXzb4iF4DaO65JYoGfUOR4tY","yvalue":"SGFzUbQBGrjYfewdGHdkbp8SSi83hg9FnilgmTam0n4"},{"kty":"EC","alg":"ES256","use":"sig","kid":"6aa8ad07cd2aaadcc656f7e2139cce8b8c4a6c81c29042f481680672fd03c969","crv":"P-256","x":"GmkmoaSBo4BmWY5Dj_PEiUwWKGhzthFoatY1Xjw4ugw","y":"ymWSPX9BMdt_VahKOMIhNk-tOtQYDe0PIGiZhHUw8RM","xvalue":"GmkmoaSBo4BmWY5Dj_PEiUwWKGhzthFoatY1Xjw4ugw","yvalue":"ymWSPX9BMdt_VahKOMIhNk-tOtQYDe0PIGiZhHUw8RM"},{"kty":"EC","alg":"ES256","use":"sig","kid":"95e9119f653eae095bb3d871d6ba8ff46467aa314575a4543615f051d4b735a6","crv":"P-256","x":"IL4tRTlHD0KoiP6Huim6yvwSwBQmhaA5vxZlJXXaH2k","y":"efilcUyOHLQCduBtAZrRWePIbsDV_lbZOIi37FMIvKE","xvalue":"IL4tRTlHD0KoiP6Huim6yvwSwBQmhaA5vxZlJXXaH2k","yvalue":"efilcUyOHLQCduBtAZrRWePIbsDV_lbZOIi37FMIvKE"},{"kty":"EC","alg":"ES256","use":"sig","kid":"fa134042993a4a1717e4ee16b0c48f354de6171f850155971885038288fb92c9","crv":"P-256","x":"LT_J9vh1ik7noqoc8Oi_4bjbRlI__nN1WHeNaYqwwPw","y":"ykFLKxm_VHbBysj5lN--baYE0yYOlG2LoMdGH8sPhfM","xvalue":"LT_J9vh1ik7noqoc8Oi_4bjbRlI__nN1WHeNaYqwwPw","yvalue":"ykFLKxm_VHbBysj5lN--baYE0yYOlG2LoMdGH8sPhfM"},{"kty":"EC","alg":"ES256","use":"sig","kid":"5cee37e69c353766a3fe01fa05bf821283541a84a6692cdeddf947d0c0904367","crv":"P-256","x":"_zheKAiuou5ceNvFv-hurCw5m7UYIXRrqXfCPbUf_Lw","y":"tQ32o8FWMCkiJ7UU92zAQvsibT9rS92sWByr5cZ1zvU","xvalue":"_zheKAiuou5ceNvFv-hurCw5m7UYIXRrqXfCPbUf_Lw","yvalue":"tQ32o8FWMCkiJ7UU92zAQvsibT9rS92sWByr5cZ1zvU"},{"kty":"EC","alg":"ES256","use":"sig","kid":"0f7ac0f8a22e131b5fe75a9ce1699aca150f7f6c0ed75e282b3bf7fb097a763e","crv":"P-256","x":"EIzavG-6hjB8DIvwAuGLuO7OxfeVR0ha5xbt_MTdeZg","y":"1UzDIaxrlWvsMBpMntHZte0U_PRI7IviTz_HM9K4rVc","xvalue":"EIzavG-6hjB8DIvwAuGLuO7OxfeVR0ha5xbt_MTdeZg","yvalue":"1UzDIaxrlWvsMBpMntHZte0U_PRI7IviTz_HM9K4rVc"},{"kty":"EC","alg":"ES256","use":"sig","kid":"7f31159a65aa4bf1ddf342b57170dd7467e92d12e84c24ca20e1442553b3f08c","crv":"P-256","x":"7BPdFkOSjWJvsDjBwWVCZ5-behCVgjPs0NJWsPs4-jE","y":"Q0QcWa0L3r2_OsdF-eb6tDX3tFOkTyWw5071b6jXoTA","xvalue":"7BPdFkOSjWJvsDjBwWVCZ5-behCVgjPs0NJWsPs4-jE","yvalue":"Q0QcWa0L3r2_OsdF-eb6tDX3tFOkTyWw5071b6jXoTA"},{"kty":"EC","alg":"ES256","use":"sig","kid":"a7968c2ea15f0f41635de5e088290491b0231a56a49cc8a6cd6ed441727a252f","crv":"P-256","x":"hBETqhIx5A2T_b-LVot0FOxYWPoZE5Ljj3Ba9R841xw","y":"_bK8ZG8giN4HoxQKgHKVQ28zGPOXigPoXsLcRugfuLw","xvalue":"hBETqhIx5A2T_b-LVot0FOxYWPoZE5Ljj3Ba9R841xw","yvalue":"_bK8ZG8giN4HoxQKgHKVQ28zGPOXigPoXsLcRugfuLw"},{"kty":"EC","alg":"ES256","use":"sig","kid":"9b1112b098f3184c6e83fc3d1be8fc217db1eb20756a156cb63ce8ce9e27dfd2","crv":"P-256","x":"jcq85fpJ78qrqk1hL6aUJocVoFO48Ywck9qsZWbfHmY","y":"xvwvA_moLdF_n8zjNGXwLMpFvvhP37hIZUB8Zr6BbOo","xvalue":"jcq85fpJ78qrqk1hL6aUJocVoFO48Ywck9qsZWbfHmY","yvalue":"xvwvA_moLdF_n8zjNGXwLMpFvvhP37hIZUB8Zr6BbOo"},{"kty":"EC","alg":"ES256","use":"sig","kid":"fe1e8d888ec664cd2afef479c5db79692cd01aacd141483a54339351f395fa27","crv":"P-256","x":"UNlpya9Zjo7768EVwkEfapRheaZck82mQW2wtKBSjc0","y":"Q8EuDvvY0mDJS4oh_rQZKxUm1Db92JesO-I5f1etHnk","xvalue":"UNlpya9Zjo7768EVwkEfapRheaZck82mQW2wtKBSjc0","yvalue":"Q8EuDvvY0mDJS4oh_rQZKxUm1Db92JesO-I5f1etHnk"},{"kty":"EC","alg":"ES256","use":"sig","kid":"8cce8f074ed02378fa80705644812a2672ed7751f5b9069893557734f21bf728","crv":"P-256","x":"NWIE-R6ok8YmHCK0QZncnP3EPGow05n8N4RAtlyAquk","y":"EL9Qcg5RNV9Km7JSe3Ld1YRsHL3izVkgQlOiFINd_K8","xvalue":"NWIE-R6ok8YmHCK0QZncnP3EPGow05n8N4RAtlyAquk","yvalue":"EL9Qcg5RNV9Km7JSe3Ld1YRsHL3izVkgQlOiFINd_K8"},{"kty":"EC","alg":"ES256","use":"sig","kid":"9291e6b6a38c7d8af68c5266faa28208d6dd59845faa024e541bdb39fe135d4b","crv":"P-256","x":"8TWT9jNtCXV2AkCGoQdvEUytKBe4OXFxiCGVSa0lixs","y":"u_vHeBxWHPW1Sb-ubGvxZRQ2LxIUUbJpqcdJexu1Rbk","xvalue":"8TWT9jNtCXV2AkCGoQdvEUytKBe4OXFxiCGVSa0lixs","yvalue":"u_vHeBxWHPW1Sb-ubGvxZRQ2LxIUUbJpqcdJexu1Rbk"},{"kty":"EC","alg":"ES256","use":"sig","kid":"7159e3eae0f7f2d868f3c09b6de930ec3363ec04526f40caec9b1f08e0f43ca6","crv":"P-256","x":"OT0ljK0p4hMmpOlUq4G847lknfGvDSz-khoCVapljyQ","y":"g2yeT_BJBgMJH3c9haa4C4hYxTYizhZt4MnbLYPRZyw","xvalue":"OT0ljK0p4hMmpOlUq4G847lknfGvDSz-khoCVapljyQ","yvalue":"g2yeT_BJBgMJH3c9haa4C4hYxTYizhZt4MnbLYPRZyw"},{"kty":"EC","alg":"ES256","use":"sig","kid":"1f067eec599b74bf4e28c243c7fba6463a035933553e31f7a388e14d44fa48e3","crv":"P-256","x":"D_vrbZSh7HHZmuaDfSKJ0c5aFjyshiL_NUSngdGhkQI","y":"yMhXKAc8hcRF3ZUK0CBtrjwn1Ib7PaehrACVvyLX4Nk","xvalue":"D_vrbZSh7HHZmuaDfSKJ0c5aFjyshiL_NUSngdGhkQI","yvalue":"yMhXKAc8hcRF3ZUK0CBtrjwn1Ib7PaehrACVvyLX4Nk"},{"kty":"EC","alg":"ES256","use":"sig","kid":"a524a404e7a97d35dc64633756305525ed2dc4a5b48a130736f74e9a3a5d4b1d","crv":"P-256","x":"OgfZTUC6kh4_zwDjNs0fIB7VgrzA9Z2TOriwlrfhV64","y":"wvkAtLoPOHUv-kWPSsWCCmO47Q3HmnLvbBNuqWZdK3g","xvalue":"OgfZTUC6kh4_zwDjNs0fIB7VgrzA9Z2TOriwlrfhV64","yvalue":"wvkAtLoPOHUv-kWPSsWCCmO47Q3HmnLvbBNuqWZdK3g"},{"kty":"EC","alg":"ES256","use":"sig","kid":"a2fd5181692cc6daf799905d0dcd7b0826b458c9fe794b9056fc7b4db61cfba4","crv":"P-256","x":"XhqTG4bh5tStunS8bxFd32RpYY8YWE3P-86pC8fYiH8","y":"PaoAzzCJEnIE6RmoiQniOfomqOKYsa9I7-rYateUgaY","xvalue":"XhqTG4bh5tStunS8bxFd32RpYY8YWE3P-86pC8fYiH8","yvalue":"PaoAzzCJEnIE6RmoiQniOfomqOKYsa9I7-rYateUgaY"},{"kty":"EC","alg":"ES256","use":"sig","kid":"c6f34e863d3e5e32ba32081402d8b3e10e8edb638568a57b2716c0f30f567103","crv":"P-256","x":"jtbdenW9fZC4JqaDRsMf58XHJLndwTmgT_dVOANZXzY","y":"9ArQK2GZ86IDl7bp2AhX-aBCS_cssafAq7dbnymFhJU","xvalue":"jtbdenW9fZC4JqaDRsMf58XHJLndwTmgT_dVOANZXzY","yvalue":"9ArQK2GZ86IDl7bp2AhX-aBCS_cssafAq7dbnymFhJU"}]}', '_fp': <http.client.HTTPResponse object at 0x7f0a496b96a0>, '_original_response': <http.client.HTTPResponse object at 0x7f0a496b96a0>, '_fp_bytes_read': 6730, 'msg': None, '_request_url': 'https://api.line.me/oauth2/v2.1/certs', '_pool': <urllib3.connectionpool.HTTPSConnectionPool object at 0x7f0a4bab73d0>, '_connection': None, 'chunked': False, 'chunk_left': None, 'length_remaining': 0}
but when I tried your suggestion
handler = WebhookHandler(CHANNEL_SECRET)
configuration = Configuration( access_token=CHANNEL_ACCESS_TOKEN)
configuration.proxy = "http://proxy.server:3128"
it returned
2023-10-20 09:09:42,851: Request body: {"destination":"Ud2674e3166e39b1831c00e57b43b4ee7","events":[{"type":"message","message":{"type":"text","id":"xx","quoteToken":"xx-hKKyYB-WnQfixfofLFyc-xx","text":"info"},"webhookEventId":"xx","deliveryContext":{"isRedelivery":true},"timestamp":1697792921561,"source":{"type":"user","userId":"xxx"},"replyToken":"xx","mode":"active"}]}
2023-10-20 09:09:42,863: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)'))': /v2/bot/profile/U9e775e52373838c0aadcc
2023-10-20 09:09:42,875: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)'))': /v2/bot/profile/U9e775e52373838c0aadcc
2023-10-20 09:09:42,886: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)'))': /v2/bot/profile/U9e775e52373838c0aadcc
...unable to get local issuer certificate (_ssl.c:1108)'))': /v2/bot/profile/U9e775e52373838c0aad2095a81fe3e14
It seems like the error message has changed, hasn't it? If you have a moment, you might want to give it another try. I believe you'll see it too...
@Yang-33 you are right the error changed...but still not able to get the message pushed
@Yang-33 @be-hase @tokuhirom I upgraded urllib3 to 1.26.9 and Python to 3.10 and it works!!
I have a slightly different question, why do I see a max limit of 500 messages for my bot? Isn't Linebot free?
IS there some that needs to be changed in this code to remove the 500 limit
https://github.com/line/line-bot-sdk-python/issues/536#issuecomment-1770248672
Here's a price table. https://www.lycbiz.com/jp/service/line-official-account/plan/
...But so , here's not a LINE official account's support channel. I will close this issue.
System Informations
Expaination
I tried to run flask-kitchensink demo, but it returned an error. Have a look at the log
Logs
2023-10-18 20:48:12,519: Request body: {"destination":"Ud2674e3166e39b1831c00xxxx","events":[{"type":"message","message":{"type":"text","id":"477866244691722338","quoteToken":"xxx","text":"hi"},"webhookEventId":"xxx","deliveryContext":{"isRedelivery":true},"timestamp":1697661781698,"source":{"type":"user","userId":"U9e775e52373838c0aad2095a8xxxx"},"replyToken":"f24784fd2d184a1abd1b51754xxx5","mode":"active"}]} 2023-10-18 20:48:13,734: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fe9f38b1130>: Failed to establish a new connection: [Errno 111] Connection refused')': /v2/bot/message/reply 2023-10-18 20:48:14,762: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fe9f38b1280>: Failed to establish a new connection: [Errno 111] Connection refused')': /v2/bot/message/reply 2023-10-18 20:48:15,782: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fe9f38b13d0>: Failed to establish a new connection: [Errno 111] Connection refused')': /v2/bot/message/reply 2023-10-18 20:48:16,816: Exception on /callback [POST] Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/urllib3/connection.py", line 158, in _new_conn conn = connection.create_connection( File "/usr/lib/python3.8/site-packages/urllib3/util/connection.py", line 80, in create_connection raise err File "/usr/lib/python3.8/site-packages/urllib3/util/connection.py", line 70, in create_connection sock.connect(sa) ConnectionRefusedError: [Errno 111] Connection refused NO MATCH During handling of the above exception, another exception occurred: NO MATCH Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 597, in urlopen httplib_response = self._make_request(conn, method, url, File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 343, in _make_request self._validate_conn(conn) File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 839, in _validate_conn conn.connect() File "/usr/lib/python3.8/site-packages/urllib3/connection.py", line 301, in connect conn = self._new_conn() File "/usr/lib/python3.8/site-packages/urllib3/connection.py", line 167, in _new_conn raise NewConnectionError( urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x7fe9f38b1520>: Failed to establish a new connection: [Errno 111] Connection refused NO MATCH During handling of the above exception, another exception occurred: NO MATCH Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/flask/app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "/usr/lib/python3.8/site-packages/flask/app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/lib/python3.8/site-packages/flask/app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise raise value File "/usr/lib/python3.8/site-packages/flask/app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "/usr/lib/python3.8/site-packages/flask/app.py", line 1935, in dispatch_request return self.view_functionsrule.endpoint File "/home/sbojja/mysite/app.py", line 149, in callback handler.handle(body, signature) File "/home/sbojja/.local/lib/python3.8/site-packages/linebot/v3/webhook.py", line 227, in handle self.invoke_func(func, event, payload) File "/home/sbojja/.local/lib/python3.8/site-packages/linebot/v3/webhook.py", line 239, in __invoke_func func(event) File "/home/sbojja/mysite/app.py", line 702, in handle_text_message line_bot_api.reply_message( File "/home/sbojja/.local/lib/python3.8/site-packages/pydantic/v1/decorator.py", line 40, in wrapper_function return vd.call(args, kwargs) File "/home/sbojja/.local/lib/python3.8/site-packages/pydantic/v1/decorator.py", line 134, in call return self.execute(m) File "/home/sbojja/.local/lib/python3.8/site-packages/pydantic/v1/decorator.py", line 206, in execute return self.raw_function(d, var_kwargs) File "/home/sbojja/.local/lib/python3.8/site-packages/linebot/v3/messaging/api/messaging_api.py", line 6570, in reply_message return self.reply_message_with_http_info(reply_message_request, kwargs) # noqa: E501 File "/home/sbojja/.local/lib/python3.8/site-packages/pydantic/v1/decorator.py", line 40, in wrapper_function return vd.call(args, kwargs) File "/home/sbojja/.local/lib/python3.8/site-packages/pydantic/v1/decorator.py", line 134, in call return self.execute(m) File "/home/sbojja/.local/lib/python3.8/site-packages/pydantic/v1/decorator.py", line 206, in execute return self.raw_function(d, **var_kwargs) File "/home/sbojja/.local/lib/python3.8/site-packages/linebot/v3/messaging/api/messaging_api.py", line 6674, in reply_message_with_http_info return self.api_client.call_api( File "/home/sbojja/.local/lib/python3.8/site-packages/linebot/v3/messaging/api_client.py", line 407, in call_api return self.call_api(resource_path, method, File "/home/sbojja/.local/lib/python3.8/site-packages/linebot/v3/messaging/api_client.py", line 212, in __call_api response_data = self.request( File "/home/sbojja/.local/lib/python3.8/site-packages/linebot/v3/messaging/api_client.py", line 451, in request return self.rest_client.post_request(url, File "/home/sbojja/.local/lib/python3.8/site-packages/linebot/v3/messaging/rest.py", line 270, in post_request return self.request("POST", url, File "/home/sbojja/.local/lib/python3.8/site-packages/linebot/v3/messaging/rest.py", line 156, in request r = self.pool_manager.request( File "/usr/lib/python3.8/site-packages/urllib3/request.py", line 70, in request return self.request_encode_body(method, url, fields=fields, File "/usr/lib/python3.8/site-packages/urllib3/request.py", line 150, in request_encode_body return self.urlopen(method, url, extra_kw) File "/usr/lib/python3.8/site-packages/urllib3/poolmanager.py", line 324, in urlopen response = conn.urlopen(method, u.request_uri, kw) File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 663, in urlopen return self.urlopen(method, url, body, headers, retries, File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 663, in urlopen return self.urlopen(method, url, body, headers, retries, File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 663, in urlopen return self.urlopen(method, url, body, headers, retries, File "/usr/lib/python3.8/site-packages/urllib3/connectionpool.py", line 637, in urlopen retries = retries.increment(method, url, error=e, _pool=self, File "/usr/lib/python3.8/site-packages/urllib3/util/retry.py", line 399, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause)) urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.line.me', port=443): Max retries exceeded with url: /v2/bot/message/reply (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7fe9f38b1520>: Failed to establish a new connection: [Errno 111] Connection refused')) 2023-10-18 20:48:16,821: OSError: write error