zewaren / python-upnp-ssdp-example Goto Github PK
View Code? Open in Web Editor NEWAn example code to advertise a device on a network using UPnP/SSDP
License: MIT License
An example code to advertise a device on a network using UPnP/SSDP
License: MIT License
Hey, I this is extremely useful, thank you so much for creating this, but there is a lot of low level programming in here, and I'm just wondering what exactly was your reference when you created this, so that maybe I can sort of trace the logic a little better, because I've never really programmed a webserver at this low of a level.
Thanks for creating this!
Hi, I thank you a lot for the code you wrote.
I adapted it for my needs in my SmartThings porting to add UPNP detection of my Pi (see https://github.com/philippeportesppo/AirMentorPro2_SmartThings).
I found your original code in main.py had a problem to be launched when the system is early in booting, meaning the network interface is not yet available.
Since I modified your code too much to fork a version of it, I just snap the code below.
The idea is to have a waiting stage till the network interface shows up.
Thanks again (ou merci si vous etes en France).
def get_network_interface_ip_address(interface='wlan0'):
"""
Get the first IP address of a network interface.
:param interface: The name of the interface.
:return: The IP address.
"""
while interface not in ni.interfaces():
print('Could not find interface %s.' % (interface,))
sleep(10)
while True:
interfacestring = ni.ifaddresses(interface)
if (2 not in interfacestring) or (len(interfacestring[2]) == 0):
print('Could not find IP of interface %s. Sleeping.' % (interface,))
sleep(10)
continue
else:
break
return interfacestring[2][0]['addr']
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.