An open API service indexing awesome lists of open source software.

https://github.com/diging/django-tethne-client

Python client for the django-tethne JSON API
https://github.com/diging/django-tethne-client

Last synced: 10 months ago
JSON representation

Python client for the django-tethne JSON API

Awesome Lists containing this project

README

          

# django-tethne-client build:

Python client for the django-tethne JSON API.

## Install

```shell
$ pip install -U django-tethne-client
```

## Examples

### Connect

```python
>>> from tethneweb.client import TethneClient
>>> client = TethneClient('http://tethne.web.instance.com', 'username', 'password')
```

### Get lists of things

```python
>>> corpora = client.list_corpora()
>>> corpora
[, ]
```

### Get related things

Relations among result objects (e.g. Corpus, Paper, Author) can be accessed as
properties. Fore xample

```python
>>> corpus = corpora[0]
>>> corpus.papers[:]
[,
,
,
,
,
,
,
,
,
,
,
...
]
```

## Methods

### ``TethneClient``

#### List methods

* ``list_corpora(limit=100, **params)``: Returns a list of ``Corpus`` objects.
* ``list_papers(limit=100, **params)``: Returns a list of ``Paper`` objects.
* ``list_authors(limit=100, **params)``: Returns a list of ``Author`` objects.

All list methods take the following parameters:

* **``limit``** (default: 100): Maximum number of records to return.
* **``params``**: Additional keyword arguments are passed to the ``params`` argument when calling [``requests.get()``](http://docs.python-requests.org/en/master/api/#requests.get).

#### Get methods

* ``get_corpus(id)``: Returns a ``Corpus`` object.
* ``get_paper(id)``: Returns a ``Paper`` object.
* ``get_author(id)``: Returns an ``Author`` object.
* ``get_institution(id)``: Returns an ``Institution`` object.

### ``Corpus``

### ``Paper``

### ``Author``

### ``Institution``

### ``Affiliation``

### ``Metadataum``

### ``Identifier``