Linebot Django 2

less than 1 minute read

LINE BOT Message 初學者記錄(二)

參考 LINE 官方網站提供新的 API referense Create LINE@ Manager account from LINE Business Center > Messaging API LINE Developer Set Webhook URL and get Channel Access Token

Process Picture:

Code:

views.py

Result:

Request: here Response : Hello, I am Nanguachumo. Type ‘w cityname’ get weather! here Request: w london Response : Current country: GB Current weather: Rain Current tempearture: 12.12  

小撇步:

  • 練習時, 一樣先跑 local server, 透過 REST 發出 POST + content, 做初步判斷程式碼有錯誤否.

Next:

  • ㄧ些 Function 看起來不只做ㄧ件事呀!, 要讓 function 都可被重覆使用
  • 圖片不知為何電腦 LINE 無法顯示
  • Template & Confirm 官方回應目前 IOS 無法正常顯示, 下ㄧ版更新後即可正常

Reference:

Get knowhow:

  • Azure run Django 無法正常使用 Static. 故強制於 urls.py 直接指定 load picture.
  • Azure local Git 不知為何有時 Clone 會失敗…
  • Line official 晚上 9點 可能 server 繁忙無法正常發送訊息
  • Python - re module
  • Python - “’”, “””, “”””” 有點不一樣
  • Python - NoneType not equal ‘None’

心得:

  • 純練習寫小程式, 95% 時間花在debug

下一篇:  Line Bot - Django - News&Food

Leave a comment