Forums

Max retries exceeded with url: /v2/bot/message/12309252810550/content

I try to deploy a chatbot on pythonanywhere and upload a image to server.

@handler.add(MessageEvent, message=(ImageMessage)) def handle_image(event):

message_content = line_bot_api.get_message_content(event.message.id)
with open("\home\wilsonsujames\mysite\assets\image\abc.jpg", 'wb') as fd:
    for chunk in message_content.iter_content():
        fd.write(chunk)

line_bot_api.reply_message(event.reply_token,TextSendMessage("圖片上傳了"))



requests.exceptions.ProxyError: HTTPSConnectionPool(host='api-data.line.me', port=443): Max retries exceeded with url: /v2/bot/message/12309252810550/content (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden')))

Could someone help.Thanks a lot.

Only some sites are whitelisted for free PythonAnywhere accounts. api-data.line.me is not. See https://www.pythonanywhere.com/whitelist/ There is an instruction on how to add sites to the whitelist. See https://help.pythonanywhere.com/pages/RequestingWhitelistAdditions/