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.
Source Distribution
Built Distribution
File details
Details for the file piate-0.1.6.tar.gz
.
File metadata
- Download URL: piate-0.1.6.tar.gz
- Upload date:
- Size: 14.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f3bc7d66307db47926135679c0656a8d24369433d054d05e8e2e749ed7ef63dd |
|
MD5 | 5234a987beee5b9696a629a2fed390f4 |
|
BLAKE2b-256 | 8c1a5cdc760085cf751e372382d3803e685c57a63685012cf02b1954aa0fa625 |
File details
Details for the file piate-0.1.6-py3-none-any.whl
.
File metadata
- Download URL: piate-0.1.6-py3-none-any.whl
- Upload date:
- Size: 18.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d9d97ccf0793b80bd91c8f32adccb118fcaabebb0f08ea0a761a5ffcce4bbb9 |
|
MD5 | 09ff005d32744be8fadcf4d4ecd30982 |
|
BLAKE2b-256 | 6116f24f59676f4a6b6aa32ced86a5c6f9bfa0cca318d53fd0a29de66d800a79 |