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.0.tar.gz
(4.6 kB
view hashes)
Built Distribution
Close
Hashes for hypothesis_api-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64dac5e7b3b6f7af57f9ed0143f8aaa6d1d9ff449a1011f2cc4be62c8c53d8cd |
|
MD5 | ef3b6a4f485418e9f49d02b7e8d5a780 |
|
BLAKE2b-256 | 1da88ffece512462d57445a21a0087906d9a2caabe6d1694bfa148729ce2eddf |