Python UPnP/IGD客户端实现? [英] Python UPnP/IGD Client Implementation?

查看:321
本文介绍了Python UPnP/IGD客户端实现?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在搜索 UPnP 客户端的开源实现,更具体地说是其实现 Internet网关设备(IGD)部分.

目前,我只能在诸如 PyMediaServer 的项目中找到UPnP Media Server实现. , PyMedS 一致性.

我确定我可以使用这些代码库作为开始,但是Media Server部分将引入不必要的复杂性.

那么您能推荐一个客户端UPnP(并希望是IGD)Python库吗?一种替代方法是将调用分派到C库,例如 MiniUPnP ,但我更喜欢纯Python实施.

更新: StackOverflow .

解决方案

MiniUPnP源代码包含使用C库作为扩展模块的Python示例代码(请参见testupnpigd.py),我认为这是解决问题的适当方法

合理的价格:这不是我一直在寻找的纯Python解决方案,但是:

  • 已经对该库进行了大量的投入,
  • 它是轻量级的(它不能解决媒体服务器问题)
  • IGD通常仅用于连接设置,因此将其与Python代码更紧密地集成似乎不是问题,
  • 作为奖励,它还提供了NAT-PNP实现(IGD的Apple并发,是UPnP client in Python, and more specifically of its Internet Gateway Device (IGD) part.

    For now, I have only been able to find UPnP Media Server implementations, in projects such as PyMediaServer, PyMedS, BRisa or Coherence.

    I am sure I could use those code bases as a start, but the Media Server part will introduce unneeded complexity.

    So can you recommend a client UPnP (and hopefully IGD) Python library? An alternative would be to dispatch calls to a C library such as MiniUPnP, but I would much prefer a pure Python implementation.

    Update: an interesting, kind of related discussion of SSDP and UPnP is available on StackOverflow.

    解决方案

    MiniUPnP source code contains a Python sample code using the C library as an extension module (see testupnpigd.py), which I consider as a proper solution to my problem.

    Rationale: this is not the pure Python solution I was looking for, but:

    • significant effort has already been invested in this library,
    • it is lightweight (it does not address Media Server issues),
    • IGD is typically only used at connection setup, so not integrating it tighter with the Python code does not seem like an issue,
    • as a bonus, it also provides a NAT-PNP implementation (the Apple concurrent of IGD, part of Bonjour).

    这篇关于Python UPnP/IGD客户端实现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆