Tools for webmention.org.
Project description
webmention-tools
Some simple tools in python to deal with webmentions.
Note, that this package was formerly known as webmentiontools, but had to be renamed due to PEP-541. (Namely, not classified as abandoned project, because the author was reachable).
Currently:
webmentiontools.send implements WebmentionSend that sends webmentions.
webmentiontools.urlinfo implements UrlInfo() that will rerurn usefull information about a web page, like title, the existance of an “in-reply-to” link, the author name, the author image, etc.
webmentiontoold.webmentionio provides a class to query webmention.io
There is also the corresponting command line tool, webmention-tools (which is also a simple example on how to use the library.
Check bin/demo.py on how to use the library to query webmention.io and present information for all URLs that mentioned http://indiewebcamp.com/webmention
Installation
pip install webmention-tools
Usage
Command line:
webmention-tools send `source` `target` webmention-tools urlinfo `url`
or
Python code to send a webmention:
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 code to get info about a webpage.
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())
Development
Create a virtualenv with python3
Change into that directory and clone the repository
Activate the virtualenv by sourceing bin/activate
Change into the cloned repository and install dependencies via `pip install -r requirements.txt’
Run pytest --cov for unit tests with code coverage
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file webmention-tools-0.4.1.tar.gz
.
File metadata
- Download URL: webmention-tools-0.4.1.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ca3529a9f573dcdec7aa9d2421055221e77cf5e2cdab73a37558898dab7c595 |
|
MD5 | 859c633b9c63118c2e95c9473608e22a |
|
BLAKE2b-256 | 9d2fae83c21fb75f7713ec922de61c35c2dd01ecaa7e863029b330b9845dbb29 |
File details
Details for the file webmention_tools-0.4.1-py3-none-any.whl
.
File metadata
- Download URL: webmention_tools-0.4.1-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f9b5517bbcc3037256699cce4d7fdf75763fc88b0bffb67b416cc7755a75660f |
|
MD5 | 8b60dbda51f90be197b6c4207af7aa39 |
|
BLAKE2b-256 | 779b5d44df99bd0fe9525b193d9a543e9061f1bc379a26946b4653a6ce7da806 |