skip to navigation
skip to content

webfinger 1.0

Simple Python implementation of WebFinger client protocol

A simple Python client implementation of WebFinger RFC 7033.

WebFinger is a discovery protocol that allows you to find information about people or things in a standardized way. See the spec or for more information.

>>> from webfinger import finger
>>> wf = finger('')
>>> wf.subject
>>> wf.avatar
>>> wf.profile
Eric Mill


finger(resource, rel=None)

finger is a convenience method for instantiating a WebFingerClient object and making the request. The resource parameter is a URI of the resource about which you are querying. The optional rel parameter can be either a string or a list of strings that will limit the response to the specific relations. WebFinger servers are not required to obey the rel parameter, so you should handle the response accordingly.

WebFingerClient supports additional options, so check that out if finger does not meet your needs.

WebFinger Client

WebFingerClient(timeout=None, official=False)
Instantiates a client object. The optional timeout parameter specifies the HTTP request timeout. The optional official parameter is a boolean that determines if the client will use unofficial endpoints.
finger(resource, host=None, rel=None, raw=False)

The client finger method prepares and executes the WebFinger request. resource and rel are the same as the parameters on the standalone finger method. host should only be specified if you want to connect to a host other than the host in the resource parameter. Otherwise, this method extracts the host from the resource parameter. raw is a boolean that determines if the method returns a WebFingerResponse object or the raw JRD response as a dict.

If the host parameter is passed to this method, unofficial endpoints are ignored. You’re asking for a specific host so who am I to disagree?

WebFinger Response

The WebFinger response object provides handy properties for easy access and the raw JRD response. Read the spec for specifics of the JRD response.


The URI of the thing that the response JRD describes.
A list of additional URIs that identify the subject.
A dict of URIs and values that provides information about the subject.
A list of dicts that define external resources for the subject.
A dict of the raw JRD response.


rel(relation, attr=’href’)

A convenience method that provides basic access to links. The relation parameter is a URI for the desired link. The attr parameter is the key of the returned value of the link that matches relation. Returns a string if relation and attr exist, otherwise None.

>>> wf.rel('')

The response JRD may have multiple entries with the same relation URI. The rel method will select the first one, since order is meant to imply priority. If you need to see all of the values, you’ll have to iterate over the links property and pull them out yourself.

>>> rel = ''
>>> [l.get('href') for l in rel.links if l.get('rel') == rel]

If attr is None, the full dict for the link will be returned.

Relation Properties

The following common link relation types are supported as properties of the response object:


>>> wf.avatar

Unofficial Endpoints

While Facebook and Twitter do not officially support WebFinger, the webfinger-unofficial project provides a proxy for basic subject information. By default, python-webfinger will attempt to use unoffical the endpoints for and resource domains. This behavior can be disabled by passing True to the official parameter:

>>> wf = finger('', official=True)



python-webfinger is distributed under the BSD license.

See LICENSE for the full terms.

File Type Py Version Uploaded on Size
webfinger-1.0.tar.gz (md5) Source 2013-11-02 5KB