Skip to main content
Donate to the Python Software Foundation or Purchase a PyCharm License to Benefit the PSF! Donate Now

Tools for webmention.org.

Project description

webmention-tools

CircleCI Vulnerabilities Coverage Maintainability

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

  1. Create a virtualenv with python3
  2. Change into that directory and clone the repository
  3. Activate the virtualenv by sourceing bin/activate
  4. Change into the cloned repository and install dependencies via `pip install -r requirements.txt’
  5. Run pytest --cov for unit tests with code coverage

Project details


Release history Release notifications

This version
History Node

0.4.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
webmention_tools-0.4.1-py3-none-any.whl (9.4 kB) Copy SHA256 hash SHA256 Wheel py3
webmention-tools-0.4.1.tar.gz (9.5 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page