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.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hypothesis_api-1.0.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hypothesis-api-1.0.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.22.0 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.2

File hashes

Hashes for hypothesis-api-1.0.0.tar.gz
Algorithm Hash digest
SHA256 53e9b2c2650ad6d2f3cb1000541ad89073ab7332578f6ead3f752b52eb8f4472
MD5 13e97315867dcda10e7822e1f9546fd6
BLAKE2b-256 da608c942bd484691673b7a406bb9adb062af4ab0d88c5688e50d633586dd916

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hypothesis_api-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.22.0 setuptools/51.1.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.2

File hashes

Hashes for hypothesis_api-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 64dac5e7b3b6f7af57f9ed0143f8aaa6d1d9ff449a1011f2cc4be62c8c53d8cd
MD5 ef3b6a4f485418e9f49d02b7e8d5a780
BLAKE2b-256 1da88ffece512462d57445a21a0087906d9a2caabe6d1694bfa148729ce2eddf

See more details on using hashes here.

Supported by

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