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
- Host: GitHub
- URL: https://github.com/diging/django-tethne-client
- Owner: diging
- License: gpl-3.0
- Created: 2016-07-15T15:11:46.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2016-11-17T21:51:06.000Z (over 9 years ago)
- Last Synced: 2025-06-29T08:37:48.970Z (12 months ago)
- Language: Python
- Size: 1.59 MB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
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``