[PYTHON] Output from Raspberry Pi to Line

# Output a message from Raspberry Pi to Line. From Line Notify image.png Select My Page. image.png Get an access token. image.png

image.png Click Publish image.png If you get a token

LineNotify.py


'''
Line Notify Test Program
'''
def LinePrint(msg):
    import requests
    token='{Obtained token}'
    headers = {'Authorization': 'Bearer %s'%token, }        
    files = {'message': (None, msg),}
    r = requests.post('https://notify-api.line.me/api/notify', headers=headers, files=files)
    print(r,r.text)
LinePrint("\nhello world")

When you run image.png You can skip messages to Line.

image.png

Recommended Posts

Output from Raspberry Pi to Line
Introduced python3-OpenCV3 to Raspberry Pi
I talked to Raspberry Pi
Introducing PyMySQL to raspberry pi3
From setting up Raspberry Pi to installing Python environment
Output to "7-segment LED" using python on Raspberry Pi 3!
Port FreeRTOS to Raspberry Pi 4B
How to get temperature from switchBot thermo-hygrometer using raspberry Pi
[Raspberry Pi] Minimum device driver creation memo to output GPIO
[Raspberry Pi] Changed Python default to Python3
Use your Raspberry Pi to read your student ID number from your student ID card
Notify LINE of body temperature from BLE thermometer with Raspberry Pi # 1
Notify LINE of body temperature from BLE thermometer with Raspberry Pi # 2
A memo when connecting bluetooth from a smartphone / PC to Raspberry Pi 4
Connect two USB cameras to Raspberry Pi 4
Upload photos from LINE Bot to Dropbox
Python> Output numbers from 1 to 100, 501 to 600> For csv
How to install NumPy on Raspberry Pi
Sum from 1 to 10
Raspberry Pi backup
Send data from Raspberry Pi using AWS IOT
How to measure line speed from the terminal
CSV output of pulse data with Raspberry Pi (CSV output)
Connect your Raspberry Pi to your smartphone using Blynk
Connect to MySQL with Python on Raspberry Pi
How to create an article from the command line
Memo of migrating Django's DB from SQLite 3 to MySQL on Docker on Raspberry Pi 4B
What is Raspberry Pi?
Easy IoT to start with Raspberry Pi and MESH
GPGPU with Raspberry Pi
Changes from Python 3.0 to Python 3.5
Try to visualize the room with Raspberry Pi, part 1
Transition from WSL1 to WSL2
How to use the Raspberry Pi relay module Python
pigpio on Raspberry pi
Try casting videos and websites from Raspberry Pi to Chromecast and Nest Hub using CATT
Raspberry Pi video camera
Raspberry Pi Bad Knowledge
Let's do Raspberry Pi?
Face detection from images taken with Raspberry Pi camera
Reverse proxy from Apache on GCP to local Raspberry Pi Apache (NAT traversal Wake on LAN [3])
DigitalSignage with Raspberry Pi
Raspberry Pi 4 setup memo
From editing to execution
Cython on Raspberry Pi
Raspberry Pi system monitoring
Play to notify Slack of environmental data using AWS PaaS from SensorTag via Raspberry Pi3
[Go language] Use OpenWeatherMap and Twitter API to regularly tweet weather information from Raspberry Pi
Easy introduction to home hack with Raspberry Pi and discord.py
Update Python for Raspberry Pi to 3.7 or later with pyenv
[Raspberry PI & Garmin GLO] Until you connect Bluetooth GPS to Raspberry Pi
I want to disable interrupts on Raspberry Pi (≒ DI / EI)
I want to send a message from Python to LINE Bot
I tried to automate [a certain task] using Raspberry Pi
Change the message displayed when logging in to Raspberry Pi
Translate I2C device driver for Arduino to Python for Raspberry pi
Connect Raspberry Pi to Alibaba Cloud IoT Platform with Python
I sent the data of Raspberry Pi to GCP (free)
Raspberry Pi 4B initial setting
Indoor monitoring using Raspberry Pi
Mutter plants with Raspberry Pi