网站提及工具。
webmention-tools的Python项目详细描述
网站提及工具
一些简单的python工具来处理web提到的问题。
注意,这个包以前被称为 webmentiontools,但是 由于 PEP-541。(即,不是 被归类为废弃项目,因为作者可以联系到)。
当前:
- webinsertiontools.send实现发送的webinsertionsend 韦伯提到。
- urlinfo实现urlinfo(),它将重新返回usefull 有关网页的信息,如标题,存在的 “回复”链接、作者姓名、作者图片等。
- webinsertiontoold.webinsertionio提供一个类来查询webinsertion.io
还有相应的命令行工具,webnotice工具 (这也是一个关于如何使用库的简单示例
检查bin/demo.py如何使用库进行查询 并显示所有提及的URL的信息 http://indiewebcamp.com/webmention
安装
pip安装webalite工具
用法
命令行:
webmention-tools send `source` `target` webmention-tools urlinfo `url`
或
发送webnotice的Python代码:
from webmentiontools.send import WebmentionSend source = 'URL of page sending the webmention' target = 'URL of page to receive the webmention' mention = WebmentionSend(source, target) mention.send()
获取网页信息的Python代码
from webmentiontools.urlinfo import UrlInfo url = 'a link to a web page' i = UrlInfo(url) if i.error: print('There was an error getting %s' % url) else: print('in-reply-to link: %s' % i.inReplyTo()) print('publication date: %s' % i.pubDate()) print('page title: %s' % i.title()) print('image link: %s' % i.image())
开发
- 用python3创建virtualenv
- 切换到该目录并克隆存储库
- 通过sourceingbin/activate 激活virtualenv
- 切换到克隆的存储库并通过“pip”安装依赖项 install-r requirements.txt'
- 对代码覆盖率为的单元测试运行pytest --cov。