Python wrapper for the Hypothesis annotation system
Project description
Hypothesis
A python wrapper for the Hypothesis API
Create an annotation using a TextQuoteSelector
h = hypothesis.Hypothesis(username=USER, token=TOKEN) # your h username and api token (from https://hypothes.is/account/developer)
url = 'url of web page to annotate'
exact = 'selected text (i.e. the quote)'
prefix = '30 chars preceding the quote'
suffix = '30 chars following the quote'
title = 'title of the web page'
tags = ["tag1", "tag2"]
text = "body of annotation, can include [markup](http://example.com)"
payload = {
"uri": url,
"target":
[{
"source": [url],
"selector":
[{
"type": "TextQuoteSelector",
"prefix": prefix,
"exact": exact,
"suffix": suffix
}
]
}],
"tags": tags,
"text": text,
"document": {
"title": [title]
},
"permissions": h.permissions,
"group": h.group
}
r = h.post_annotation(payload)
print r.status_code
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
hypothesis-api-1.0.1.tar.gz
(4.6 kB
view hashes)
Built Distribution
Close
Hashes for hypothesis_api-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc59fe4cae85072c60c833dc30b2e2ece69af19bc97338c855d0671d76d31a2b |
|
MD5 | a1801103a973cb10db49899c8dff3717 |
|
BLAKE2b-256 | 18e378fbe76e53537680b8e699714d24b66a4333eb99ceca8d895a8a3c952210 |