Skip to main content

Python wrapper for the Hypothesis annotation system

Project description


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

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]("
payload = {
    "uri": url,
            "source": [url],
                    "type": "TextQuoteSelector", 
                    "prefix": prefix,
                    "exact": exact,
                    "suffix": suffix
    "tags": tags,
    "text": text,
     "document": {
         "title": [title]
     "permissions": h.permissions,

r = h.post_annotation(payload)
print r.status_code

Project details

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.2.tar.gz (8.4 kB view hashes)

Uploaded source

Built Distribution

hypothesis_api-1.0.2-py3-none-any.whl (9.0 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page