Getting started

Installation

Using pip

(.venv) $ pip install pyeuropeana

From source

(.venv) $ git clone https://github.com/europeana/rd-europeana-python-api.git
(.venv) $ cd rd-europeana-python-api
(.venv) $ pip install .

Authentication

Get your API key here

Set EUROPEANA_API_KEY as an environment variable running the following command in the terminal

(.venv) $ export EUROPEANA_API_KEY=yourapikey

You can also set it from python with

import os
os.environ['EUROPEANA_API_KEY'] = 'yourapikey'

Quickstart

Search API

import pyeuropeana.apis as apis
import pyeuropeana.utils as utils

# use this function to search our collections
result = apis.search(
   query = '*',
   qf = '(skos_concept:"http://data.europeana.eu/concept/base/48" AND TYPE:IMAGE)',
   reusability = 'open AND permission',
   media = True,
   thumbnail = True,
   landingpage = True,
   colourpalette = '#0000FF',
   theme = 'photography',
   sort = 'europeana_id',
   profile = 'rich',
   rows = 1000,
   ) # this gives you full response metadata along with cultural heritage object metadata

   # use this utility function to transform a subset of the cultural heritage object metadata
   # into a readable Pandas DataFrame
dataframe = utils.search2df(result)

Record API

import pyeuropeana.apis as apis

# gets the metadata from an object using its europeana id
data = apis.record('/79/resource_document_museumboerhaave_V35167')

Entity API

import pyeuropeana.apis as apis

# suggests an entity based on a text query
data = apis.entity.suggest(
text = 'leonardo',
TYPE = 'agent',
language = 'es'
)

# retrieves the data from an entity using the identifier
data = apis.entity.retrieve(
TYPE = 'agent',
IDENTIFIER = 3
)

# resolves entities from an input URI
data = apis.entity.resolve('http://dbpedia.org/resource/Leonardo_da_Vinci')

IIIF API

import pyeuropeana.apis as apis

# The IIIF API is mostly used to access newspapers collections at Europeana

# returns metadata about the newspapers with content matching the query
data = apis.iiif.search(
query = 'Paris',
profile = 'hits'
)

# returns a minimal set of metadata for a newspaper
data = apis.iiif.manifest('/9200356/BibliographicResource_3000118390149')

# returns text and annotations for a given page of a newspaper
data = apis.iiif.annopage(
RECORD_ID = '/9200356/BibliographicResource_3000118390149',
PAGE_ID = 1
)

# returns the transciption of a single page of a newspaper
data = apis.iiif.fulltext(
RECORD_ID = '/9200396/BibliographicResource_3000118435063',
FULLTEXT_ID = '8ebb67ccf9f8a1dcc2ea119c60954111'
)