Skip to main content

A Python module for making HTTP requests to Online Linguistic Database (OLD) instances.

Project description

This package is a client module for OLD web services. It facilitates making HTTP requests to interact with one or more OLD instances.

Installation:

$ pip install oldclient

For example usage, see the src/example.py file. In summary:

>>> from oldclient import OLDClient
>>> options = {
...     'url': '<URL_TO_AN_OLD_INSTANCE>',
...     'username': '<YOUR_USERNAME>',
...     'password': '<YOUR_PASSWORD>'}
>>> old_client = OLDClient(options['url'])
>>> old_client.login(options['username'], options['password'])
True
>>> form = old_client.models['form'].copy()
>>> form['transcription'] = 'Arma virumque cano.'
>>> form['translations'].append({
...     'transcription': 'I sing of arms and a man.',
...     'grammaticality': ''})
>>> response = old_client.create(
...     'forms',
...     data=form)
>>> print(response['id'])
1061

The src/example.py file will create a stock form on an OLD you specify and have access to:

$ python src/example.py \
      -o <URL_TO_AN_OLD_INSTANCE> \
      -u <YOUR_USERNAME> \
      -p <YOUR_PASSWORD>
John Doe created a new form with id 1059 on 2018-11-20T07:05:58.
See https://app.dative.ca/#form/1059.

If you are logged in to your OLD instance in Dative, you should be able to see the form just created (the first three words from Virgil’s Aeneid) at the above URL.

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

oldclient-0.0.1.tar.gz (5.5 kB view details)

Uploaded Source

File details

Details for the file oldclient-0.0.1.tar.gz.

File metadata

  • Download URL: oldclient-0.0.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.19.4 CPython/3.6.0

File hashes

Hashes for oldclient-0.0.1.tar.gz
Algorithm Hash digest
SHA256 05022093c10b721c0ebe3568f30b6db50296a020f32907a57673be7be8ba123f
MD5 2af2f157fc4b029a7a5d667251b5f53b
BLAKE2b-256 fca343a19c96f2a5ff5fdf3fff0f1da74eba110c451401a9c2dcc5aab3786245

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