Skip to main content

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


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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file hypothesis-api-1.0.2.tar.gz.

File metadata

  • Download URL: hypothesis-api-1.0.2.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for hypothesis-api-1.0.2.tar.gz
Algorithm Hash digest
SHA256 afa8e8db482d6b25cbecf60c5bc3a822d6326a5a865f7bf27bf9d0ac5e60980a
MD5 a841ca7b2cb74a07d2760b9c88457292
BLAKE2b-256 94827916389957e9383ed3e74214f9a8ca609fb7d920fa2aefec4e5d4b764f34

See more details on using hashes here.

File details

Details for the file hypothesis_api-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: hypothesis_api-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for hypothesis_api-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 108f5c033eabaf8c173f945254ffaf1543f555e259a37439e6251af2e0a937a9
MD5 8e10cb07384902babd7ec5395cf96d5e
BLAKE2b-256 39e0b0c0260a84ec69a0fd36c1e202d64b8dc4e04194d6725b7164c1622eb8cc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page