---
# System prepended metadata

title: '**2021/08/18 (LINE Notify)**'
tags: [2021/08/18, 藍柏婷]

---

# **2021/08/18 (LINE Notify)**

###### tags: `藍柏婷`
###### tags: `2021/08/18`

### **[== NVIDIA Jetson Nano機器學習應用-你戴口罩了嗎?結合Line通訊平台進行即時監控 ==](https://www.rs-online.com/designspark/nvidia-jetson-nano-line-cn)**
:::warning
**因為Webhooks無法使用，方案取消，改做為參考用**
:::

### **== 程式碼2 ==**
```python=
import requests
def send_to_line(category='',pic=''):
    send={  # 網路上大多叫"payload"
        'message':("嗨，你好\n  這是 \"火災警示\" 通知\n  請注意!!\n  偵測到 \"{0}\" 溫度過高".format(category)),
        'imageThumbnail':pic, 
        'imageFullsize':pic,
        } 
    header={
        'Content-Type':'application/x-www-form-urlencoded', 
        'Authorization':'Bearer ' + "gOljwt8lLAnbpWSIXUk3RJP34Syw6NQADBtorl2GoCP" 
        }
    r=requests.post("https://notify-api.line.me/api/notify", headers=header, data=send)
    print(r.text) # {"status":200,"message":"ok"}
    print(r.status_code) # 200

danger=1
if danger!=0:
    category="microwave"
    pic='https://imgcdn.cna.com.tw/www/WebPhotos/800/20210427/1920x1280_581754849593.jpg'
    send_to_line(category,pic)

```