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

https://github.com/drewsonne/piate

A library to integrate with the IATE API.
https://github.com/drewsonne/piate

eu iate linguistics python

Last synced: 8 months ago
JSON representation

A library to integrate with the IATE API.

Awesome Lists containing this project

README

          

# piate

Piate (pronounced pi-ay-tee-ee) is a python library and cli tool to interact with the [IATE (**I**nter**a**ctive **T**erminology for **E**urope)](https://iate.europa.eu/home) database.

- [CLI tool](#cli-tool)
- [Library](#api)

# Installing

```commandline
pip install piate
```

# CLI tool

```shell
$ iate --help
```

## Filtering

It's suggested to use a json filtering library such as [`jq`](https://stedolan.github.io/jq/) to filter the responses on the command line.

For example, only select official languages:
```shell
iate inventories list-languages | jq '[.[] | select(.is_official == true)]'
```

# Library

For further details see the official [IATE API documentation](https://documenter.getpostman.com/view/4028985/RztoMTwn).

- [client()](#client)
- [collections](#collections)
- [pages()](#collection-pages)
- [institutions](#institutions)
- [pages()](#institution-pages)
- [domains](#domains)
- [list()](#domains-list)
- [inventories](#inventories)
- [pages_languages()](#inventories-pages_languages)
- [pages_query_operators()](#inventories-pages_query_operators)
- [pages_term_types()](#inventories-pages_term_types)
- [pages_searchable_fields()](#inventories-pages_searchable_fields)
- [pages_primarities()](#inventories-pages_primarities)
- [pages_reliabilities()](#inventories-pages_reliabilities)
- [entries](#entries)
- [pages_search()](#entries-search) ___NOT IMPLEMENTED___

## client(**kwargs)

The entrypoint into the library, allowing the provision of authentication.

#### Parameters

- **username** _(string)_ -- Username to use to authenticate against the API. Conflicts with `session`. Requires `password`.
- **password** _(string)_ -- Password to use to authenticate against the API. Conflicts with `session`. Requires `username`.
- **session** _(piate.api.session.Session)_ -- Session object to use to authenticate against the API. Conflicts with `username` and `password`.

#### Examples

```python
# Example with username and password
import piate

iate_client = piate.client(username="myusername", api_key="...")
```

```python
# Example with session object
import piate
from piate.api.session import Session
from piate.api.credentials import Credentials

iate_client = piate.client(
session=Session(
credentials=Credentials(
username="myusername",
api_key="..."
)
)
)
```

## Collections

A resource representing collections

```python
import piate

collections = piate.client(...).collections
```

These are the available methods:

- [_`pages()`_](#collection-pages)

### **pages()**

Iterate through pages of responses for Collections objects.

#### Examples

```python
for page in collections.pages():
for collection in page.items:
print(collection.name)
```

## Institutions

A resource representing institutions

```python
import piate

institutions = piate.client(...).institutions
```

These are the available methods:

- [_`pages()`_](#institution-pages)

### **pages()**

Iterate through pages of response for Institutions objects.

#### Examples

```python
for page in institutions.pages():
for institution in page.items:
print(institution.name)
```

## Domains

A resource representing domains

```python
import piate

domains = piate.client(...).domains
```

These are the available methods:

- [_`list()`_](#domains-list)

### **list()**

List all the available domains.

#### Examples

```python
for domain in domains.list():
print(domain.name)
```

## Inventories

A resoure representing inventories

```python
import piate

inventories = piate.client(...).inventories
```

These are the available methods:

- [_`pages_languages()`_](#inventories-pages_languages)
- [_`pages_query_operators()`_](#inventories-pages_query_operators)
- [_`pages_term_types()`_](#inventories-pages_term_types)
- [_`pages_searchable_fields()`_](#inventories-pages_searchable_fields)
- [_`pages_primarities()`_](#inventories-pages_primarities)
- [_`pages_reliabilities()`_](#inventories-pages_reliabilities)

### **pages_languages(\*\*kwargs)**

Iterate through pages of response for language objects.

#### Parameters

- **translation_language** _(string)_ -- Translation Language

#### Examples

```python
for page in inventories.pages_languages(translation_language="en"):
for language in page.items:
print(language.name)
```

### **pages_query_operators(\*\*kwargs)**

Iterate through pages of response for language objects.

#### Parameters

- **translation_language** _(string)_ -- Translation Language

#### Examples

```python
for page in inventories.pages_query_operators(translation_language="en"):
for query_operators in page.items:
print(query_operators.name)
```

### **pages_term_types(\*\*kwargs)**

Iterate through pages of response for language objects.

#### Parameters

- **translation_language** _(string)_ -- Translation Language

#### Examples

```python
for page in inventories.pages_term_types(translation_language="en"):
for term_types in page.items:
print(term_types.name)
```

### **pages_searchable_fields(\*\*kwargs)**

Iterate through pages of response for language objects.

#### Parameters

- **translation_language** _(string)_ -- Translation Language

#### Examples

```python
for page in inventories.pages_searchable_fields(translation_language="en"):
for searchable_field in page.items:
print(searchable_field.name)
```

### **pages_primarities(\*\*kwargs)**

Iterate through pages of response for language objects.

#### Parameters

- **translation_language** _(string)_ -- Translation Language

#### Examples

```python
for page in inventories.pages_primarities(translation_language="en"):
for primarities in page.items:
print(primarities.name)
```

### **pages_reliabilities(\*\*kwargs)**

Iterate through pages of response for language objects.

#### Parameters

- **translation_language** _(string)_ -- Translation Language

#### Examples

```python
for page in inventories.pages_reliabilities(translation_language="en"):
for reliabilities in page.items:
print(reliabilities.name)
```

## Entries

A resoure representing vocabulary entries

```python
import piate

entries = piate.client(...).entries
```

These are the available methods:

- [_`pages_search()`_](#entries-search)

### **pages_search(\*\*kwargs)**

__NOTE: Not yet mplemented__

Iterate through pages of vocabulary entries

#### Parameters

- **fields_set_name** _(string)_ -- Defines the set of fields which will be returned.
Currently only accepted values are `minimal` and `full`.
- **query** _(string)_ -- The query to execute to search
- **source** _(string)_ -- The source language of the terminology data.