Skip to main content

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

Metadata

Release files for hypothesis-api 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hypothesis-api 1.0.2
File Size Uploaded
hypothesis-api-1.0.2.tar.gz 8.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hypothesis-api 1.0.2
File Interpreter ABI Platform
hypothesis_api-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 17.4 kB

Release files / hypothesis-api-1.0.2.tar.gz

Download URL hypothesis-api-1.0.2.tar.gz
Size 8.4 kB
Tags Source
SHA-256 checksum
How to use checksums
afa8e8db482d6b25cbecf60c5bc3a822d6326a5a865f7bf27bf9d0ac5e60980a
BLAKE2b-256 checksum
How to use checksums
94827916389957e9383ed3e74214f9a8ca609fb7d920fa2aefec4e5d4b764f34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.6.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.10

Release files / hypothesis_api-1.0.2-py3-none-any.whl

Download URL hypothesis_api-1.0.2-py3-none-any.whl
Size 9.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
108f5c033eabaf8c173f945254ffaf1543f555e259a37439e6251af2e0a937a9
BLAKE2b-256 checksum
How to use checksums
39e0b0c0260a84ec69a0fd36c1e202d64b8dc4e04194d6725b7164c1622eb8cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.6.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.10

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page