Python Library to interact with the IATE database
Project description
piate
A python library and cli tool to interact with the IATE (Interactive Terminology for Europe) database.
Installing
pip install piate
CLI tool
Currently working commands:
iate list-collections
iate list-domains
iate list-institutions
iate inventories list-languages
iate inventories list-primarities
iate inventories list-query-operators
iate inventories list-reliabilities
iate inventories list-searchable-fields
iate inventories list-term-types
Filtering
It's suggested to use the jq
to filter the responses on the command line.
For example, only select official languages:
iate inventories list-languages | jq '[.[] | select(.is_official == true)] | length'
Library
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
. Requirespassword
. - password (string) -- Password to use to authenticate against the API. Conflicts with
session
. Requiresusername
. - session (piate.api.session.Session) -- Session object to use to authenticate against the API. Conflicts with
username
andpassword
.
Examples
# Example with username and password
import piate
iate_client = piate.client(username="myusername", api_key="...")
# 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
import piate
collections = piate.client(...).collections
These are the available methods:
pages()
Iterate through pages of responses for Collections objects.
Examples
for page in collections.pages():
for collection in page.items:
print(collection.name)
Institutions
A resource representing institutions
import piate
institutions = piate.client(...).institutions
These are the available methods:
pages()
Iterate through pages of response for Institutions objects.
Examples
for page in institutions.pages():
for institution in page.items:
print(institution.name)
Domains
A resource representing domains
import piate
domains = piate.client(...).domains
These are the available methods:
list()
List all the available domains.
Examples
for domain in domains.list():
print(domain.name)
Inventories
A resoure representing inventories
import piate
inventories = piate.client(...).inventories
These are the available methods:
pages_languages()
pages_query_operators()
pages_term_types()
pages_searchable_fields()
pages_primarities()
pages_reliabilities()
pages_languages(**kwargs)
Iterate through pages of response for language objects.
Parameters
- translation_language (string) -- Translation Language
Examples
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
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
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
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
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
for page in inventories.pages_reliabilities(translation_language="en"):
for reliabilities in page.items:
print(reliabilities.name)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.