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.1.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.1-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hypothesis-api-1.0.1.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.1.tar.gz
Algorithm Hash digest
SHA256 c41c2d1e94ec955aeeb3cb4fb743d7e8d25b750bd04410fd9a269a2eab245a5d
MD5 d9b59207fc1c13277f5e8aa5d5fe5841
BLAKE2b-256 e4d8bbdcfb5660a62a26595f32da770b6ecc05f69a64a63fdfd38b00c3821fcf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hypothesis_api-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.0 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cc59fe4cae85072c60c833dc30b2e2ece69af19bc97338c855d0671d76d31a2b
MD5 a1801103a973cb10db49899c8dff3717
BLAKE2b-256 18e378fbe76e53537680b8e699714d24b66a4333eb99ceca8d895a8a3c952210

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