API Client

A wrapper for the Semetric (and Musicmetric) API.

The SemetricAPI is the main entry point for interacting the with Semetric API:

>>> from semetric.apiclient import SemetricAPI
>>> from semetric.apiclient.entity import Artist

>>> semetricapi = SemetricAPI(apitoken)
>>> artist = semetricapi.get(Artist, id="fe66302b0aee49cfbd7d248403036def")
>>> artist.name
"Lady Gaga"

SemetricAPI

class semetric.apiclient.SemetricAPI(apikey, baseurl=None)[source]

The main API wrapper class for the Semetric API.

get(entity, **kwargs)[source]

Query the API to get an Entity from the API based on id params.

Parameters:
  • entity (semetric.apiclient.entity.Entity) – The entity type to query.
  • kwargs (kwargs) – extra arguments depending on the entity type.
Returns:

semetric.apiclient.entity.Entity – the result from the query.

Raises :

semetric.apiclient.exc.APIError

search(entity, **kwargs)[source]

Search for Entities in using the API

Parameters:
  • entity (semetric.apiclient.entity.Entity) – The entity type to query.
  • kwargs (kwargs) – extra arguments depending on the entity type.
Returns:

semetric.apiclient.entity.Entity – the result from the query.

Raises :

semetric.apiclient.exc.APIError

Project Versions

Table Of Contents

Previous topic

Semetric API Wrapper

Next topic

Semetric Entity Types

This Page