Experimental HATEOAS client
Python
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
README.md
love.py

README.md

Love

Love is an experimental HATEOAS client. Retrieves HTTP(S) resources and follows links found in them. Currently only supports the Link HTTP header.

TODO

  • Support more than HTTP GET
  • Support finding links in hypertext (XML + XPath?). JSON would be nice, but how does hyperlinking work without hypertext?

Goal

Given an api that looks like this:

GET /
<links>
  <link rel="users" href="/users/"/>
  <link rel="items" href="/items/"/>
</links>
GET /users/
<users>
  <user name="alice">
    <link rel="profile" href="/users/alice/"/>
  </user>
</users>
GET /users/alice/
<user>
  <city>Anytown</city>
</user>

One should be able to write something like:

>>> service = Service('http://example.com/')
>>> service.users.find('//[@name="alice"]').profile.get('//city/text()')
'Anytown'