| Home | Trees | Index | Help |
|
|---|
|
|
object --+
|
Api
The base class providing access to the web api functionality via method calls.
usage:>>> import api as connotea >>> api = connotea.Api('user', 'password') >>> bookmarks = api.query('bookmarks', user='user') >>> posts = api.query(uri='http://www.dlib.org/dlib/may06/apps/05apps.html') >>> posts[0].bookmark.citation.authors [u'Ann Apps', u'Ross MacIntyre'] >>> newPost = api.add('http://www.zim.mpg.de/',('zim','heinz nixdorf')) >>> newPost.description >>> newPost.description = 'new description' >>> newPost = api.edit(newPost, comment='new comment') >>> newPost.description u'new description' >>> newPost.comments.pop().entry u'new comment' >>> api.remove(newPost)
|
|||
| __init__(self, user, password, authenticate=False, debug=False) | |||
|
_request(self,
url,
data=None,
errorHandler=None)
generic connotea WebAPI request |
|||
|
add(self,
uri,
tags,
title=None,
description=None,
mywork=False,
private=False,
comment=None)
Quote from the web api specification: |
|||
|
edit(self,
post,
comment=None)
Updates a Post. |
|||
|
getBookmark(self,
post)
get a complete Bookmark object associated with a Post instance. |
|||
|
getTags(self,
object)
return a list of Tag instances for object's list of tag names
|
|||
|
query(self,
what='posts',
user=None,
tag=None,
date=None,
uri=None,
uriMd5=None,
num=None,
start=None,
q=None)
query URLs are constructed as follows. |
|||
|
remove(self,
what)
Removes a post specified as Post instance or uri. |
|||
|
Inherited from |
|||
|
|||
| AUTH_HOST | |||
| AUTH_REALM | |||
| BASE_URL | |||
|
Inherited from |
|||
|
|||
|
|
New posts can be created by submitting an HTTP POST request to
http://www.connotea.org/data/add
The body of the POST should be simply an HTML form-style set of key=value URL-escaped pairs.
The fields available are listed below. The uri and tags fields are required, alll other fields are optional.
- uri => the URL for the bookmark you're creating
- tags => a string representing the tags. Individual tags should be comma- or space-separated, and multi-word tags must be enclosed in quotes ("")
- usertitle => the title to use for the post
- description => description of the bookmark
- mywork => 0 or 1. If 1, it means you are claiming authorship (or co-authorship) of the work being bookmarked
- private => 0 or 1. 0 means the post is shared with all, 1 means it is kept private to the user.
- comment => HTML for a comment. Note that newlines will be automatically converted to <br/>.
|
|
|
object's list of tag names
|
query URLs are constructed as follows. URL path compoents:
|
|
|
|||
AUTH_HOST
|
AUTH_REALM
|
BASE_URL
|
| Home | Trees | Index | Help |
|
|---|
| Generated by Epydoc 3.0alpha2 on Sat May 20 21:44:57 2006 | http://epydoc.sf.net |