Skip to content

Instantly share code, notes, and snippets.

@DylanGore
Created April 6, 2018 15:35
Show Gist options
  • Save DylanGore/aacefbeb99644db6c9cec59dd3b50756 to your computer and use it in GitHub Desktop.
Save DylanGore/aacefbeb99644db6c9cec59dd3b50756 to your computer and use it in GitHub Desktop.
Simple python script designed with RPi headless in mind. It will get the local IP address on boot and send it as a PushBullet notification.
#! /usr/local/bin/python3
import netifaces
from pushbullet import Pushbullet
#Setup PushBullet
pb = Pushbullet("YOUR_PB_API_KEY")
#Gets the local IP of the wlan0 interface
localip = netifaces.ifaddresses('wlan0')[netifaces.AF_INET][0]['addr']
#Send push
pb.push_note("Raspberry Pi IP", localip)
#print(localip)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment