|
| 1 | +webmention-tools |
| 2 | +================ |
| 3 | + |
| 4 | +|CircleCI| |Vulnerabilities| |Coverage| |Maintainability| |
| 5 | + |
| 6 | +Some simple tools in python to deal with webmentions. |
| 7 | + |
| 8 | +Note, that this package was formerly known as |
| 9 | +`webmentiontools <https://pypi.org/project/webmentiontools/>`__, but had |
| 10 | +to be renamed due to |
| 11 | +`PEP-541 <https://www.python.org/dev/peps/pep-0541/>`__. (Namely, not |
| 12 | +classified as abandoned project, because the author was reachable). |
| 13 | + |
| 14 | +Currently: |
| 15 | + |
| 16 | +- webmentiontools.send implements WebmentionSend that sends |
| 17 | + webmentions. |
| 18 | +- webmentiontools.urlinfo implements UrlInfo() that will rerurn usefull |
| 19 | + information about a web page, like title, the existance of an |
| 20 | + "in-reply-to" link, the author name, the author image, etc. |
| 21 | +- webmentiontoold.webmentionio provides a class to query webmention.io |
| 22 | + |
| 23 | +There is also the corresponting command line tool, webmention-tools |
| 24 | +(which is also a simple example on how to use the library. |
| 25 | + |
| 26 | +Check `bin/demo.py <./bin/demo.py>`__ on how to use the library to query |
| 27 | +webmention.io and present information for all URLs that mentioned |
| 28 | +http://indiewebcamp.com/webmention |
| 29 | + |
| 30 | +Installation |
| 31 | +============ |
| 32 | + |
| 33 | +pip install webmention-tools |
| 34 | + |
| 35 | +Usage |
| 36 | +===== |
| 37 | + |
| 38 | +Command line: |
| 39 | + |
| 40 | +:: |
| 41 | + |
| 42 | + webmention-tools send `source` `target` |
| 43 | + webmention-tools urlinfo `url` |
| 44 | + |
| 45 | +or |
| 46 | + |
| 47 | +Python code to send a webmention: |
| 48 | + |
| 49 | +:: |
| 50 | + |
| 51 | + from webmentiontools.send import WebmentionSend |
| 52 | + source = 'URL of page sending the webmention' |
| 53 | + target = 'URL of page to receive the webmention' |
| 54 | + mention = WebmentionSend(source, target) |
| 55 | + mention.send() |
| 56 | + |
| 57 | +Python code to get info about a webpage. |
| 58 | + |
| 59 | +:: |
| 60 | + |
| 61 | + from webmentiontools.urlinfo import UrlInfo |
| 62 | + url = 'a link to a web page' |
| 63 | + i = UrlInfo(url) |
| 64 | + if i.error: |
| 65 | + print('There was an error getting %s' % url) |
| 66 | + else: |
| 67 | + print('in-reply-to link: %s' % i.inReplyTo()) |
| 68 | + print('publication date: %s' % i.pubDate()) |
| 69 | + print('page title: %s' % i.title()) |
| 70 | + print('image link: %s' % i.image()) |
| 71 | + |
| 72 | +Development |
| 73 | +=========== |
| 74 | + |
| 75 | +1. Create a virtualenv with python3 |
| 76 | +2. Change into that directory and clone the repository |
| 77 | +3. Activate the virtualenv by ``source``\ ing ``bin/activate`` |
| 78 | +4. Change into the cloned repository and install dependencies via \`pip |
| 79 | + install -r requirements.txt' |
| 80 | +5. Run ``pytest --cov`` for unit tests with code coverage |
| 81 | + |
| 82 | +.. |CircleCI| image:: https://circleci.com/gh/Ryuno-Ki/webmention-tools.svg?style=svg |
| 83 | + :target: https://circleci.com/gh/Ryuno-Ki/webmention-tools |
| 84 | +.. |Vulnerabilities| image:: https://img.shields.io/snyk/vulnerabilities/github/Ryuno-Ki/webmention-tools.svg?style=popout |
| 85 | +.. |Coverage| image:: https://codecov.io/gh/Ryuno-Ki/webmention-tools/branch/master/graph/badge.svg |
| 86 | + :target: https://codecov.io/gh/Ryuno-Ki/webmention-tools |
| 87 | +.. |Maintainability| image:: https://api.codeclimate.com/v1/badges/bb63f7d3f38456ea8770/maintainability |
| 88 | + :target: https://codeclimate.com/github/Ryuno-Ki/webmention-tools/maintainability |
0 commit comments