RFC6415 lookup (albeit preferring HTTPS) for Python 3.

Mikael Nordfeldth 785cd71c9a parse_uri_components instead of parse_host_data 8 years ago
hostmeta 785cd71c9a parse_uri_components instead of parse_host_data 8 years ago
.gitignore 88bde9cc07 Init commit 8 years ago
COPYING a2cacc4c8f Initial commit, initial implementation. Most files copied or modified from other projects. 8 years ago
LICENSE a2cacc4c8f Initial commit, initial implementation. Most files copied or modified from other projects. 8 years ago
MANIFEST.in a2cacc4c8f Initial commit, initial implementation. Most files copied or modified from other projects. 8 years ago
README.rst a2cacc4c8f Initial commit, initial implementation. Most files copied or modified from other projects. 8 years ago
requirements.txt a2cacc4c8f Initial commit, initial implementation. Most files copied or modified from other projects. 8 years ago
setup.py a2cacc4c8f Initial commit, initial implementation. Most files copied or modified from other projects. 8 years ago

README.rst

========
hostmeta
========

A simple Python client implementation of `Web Host Metadata RFC 6415 `_.

Web Host Metadata is a discovery protocol that allows you to find information about endpoints on a webserver host, given that you have a hostname to look up, in a standardized way. See the `spec `_ for more information.

Basic usage::

>>> from hostmeta import get_host_meta
>>> hm = get_host_meta('social.umeahackerspace.se')
>>> len(hm.link)
6
>>> hm.find_link('http://apinamespace.org/oauth/request_token').href
'https://social.umeahackerspace.se/api/oauth/request_token'
>>>
>>> wf_url = hm.webfinger.apply_template('acct:mmn@social.umeahackerspace.se')
>>> wf_url
'https://social.umeahackerspace.se/.well-known/webfinger?resource=acct%3Ammn%40social.umeahackerspace.se'
>>> import rd
>>> wf = rd.loads(requests.get(wf_url, headers={'Content-Type': hm.webfinger.type}).text, hm.webfinger.type)
>>> wf.find_link('describedby').href
'https://social.umeahackerspace.se/mmn/foaf'


get_host_meta
=============

get_host_meta(host, scheme='https')
*get_host_meta* will lookup a certain host with the optionally specific scheme. The *host* parameter is a fully qualifiable domain name. The optional *scheme* parameter lets you override the default policy of connecting using HTTPS.

Dependencies
============

* `requests `_


License
=======

python-hostmeta is distributed under the `BSD license `_.

See LICENSE for the full terms.