tvdbapi_client package

Submodules

tvdbapi_client.api module

Provide API client for TVDB API v2.0 services.

class tvdbapi_client.api.TVDBClient(apikey=None, username=None, userpass=None)

Bases: object

TVDB Api client.

Create new instance of API client.

Parameters:
  • apikey (str) – apikey from thetvdb
  • username (str) – username used on thetvdb
  • userpass (str) – password used on thetvdb
authenticate()

Aquire authorization token for using thetvdb apis.

get_episode(*args, **kwargs)

Return the full information for a given episode id.

Warning

authorization token required

Parameters:episode_id (str) – id of episode as found on thetvdb
Returns:episode record
Return type:dict
get_episodes(*args, **kwargs)

All episodes for a given series.

Paginated with 100 results per page.

Warning

authorization token required

The following search arguments currently supported:

  • airedSeason
  • airedEpisode
  • imdbId
  • dvdSeason
  • dvdEpisode
  • absoluteNumber
  • page
Parameters:series_id (str) – id of series as found on thetvdb
Parm kwargs:keyword args to search/filter episodes by (optional)
Returns:series episode records
Return type:list
get_episodes_summary(*args, **kwargs)

Return a summary of the episodes and seasons for the series.

Warning

authorization token required

Note

Season “0” is for all episodes that are considered to be specials.

Parameters:series_id (str) – id of series as found on thetvdb
Returns:summary of the episodes and seasons for the series
Return type:dict
get_series(*args, **kwargs)

Retrieve series record.

Warning

authorization token required

Parameters:series_id (str) – id of series as found on thetvdb
Returns:series record
Return type:dict
get_series_image_info(*args, **kwargs)

Return a summary of the images for a particular series.

Warning

authorization token required

Parameters:series_id (str) – id of series as found on thetvdb
Returns:summary of the images for the series
Return type:dict
headers

Provide access to updated headers.

language

Provide access to current language.

search_series(*args, **kwargs)

Provide the ability to search for a series.

Warning

authorization token required

The following search arguments currently supported:

  • name
  • imdbId
  • zap2itId
Parameters:kwargs – keyword arguments to search for series
Returns:series record or series records
Return type:dict
session

Provide access to request session with local cache enabled.

token_expired

Provide access to flag indicating if token has expired.

tvdbapi_client.api.requires_auth(func)

Handle authentication checks.

@tvdbapi_client.api.requires_auth

Checks if the token has expired and performs authentication if needed.

tvdbapi_client.exceptions module

Exceptions for API and decorator to wrap request exceptions.

exception tvdbapi_client.exceptions.TVDBRequestException(*args, **kwargs)

Bases: requests.exceptions.RequestException

Provide a base exception for local use.

Initialize RequestException with request and response objects.

tvdbapi_client.exceptions.error_map(func)

Wrap exceptions raised by requests.

@tvdbapi_client.exceptions.error_map

tvdbapi_client.options module

tvdbapi_client.options.list_opts()

Returns a list of oslo_config options available in the library.

The returned list includes all oslo_config options which may be registered at runtime by the library. Each element of the list is a tuple. The first element is the name of the group under which the list of elements in the second element will be registered. A group name of None corresponds to the [DEFAULT] group in config files. The purpose of this is to allow tools like the Oslo sample config file generator to discover the options exposed to users by this library.

Returns:a list of (group_name, opts) tuples

tvdbapi_client.timeutil module

Time related utilities and helper functions.

tvdbapi_client.timeutil.is_newer_than(after, delta)

Checks if a datetime is newer than delta

Parameters:
  • after (datetime) – a datetime to check
  • delta (timedelta) – period of time to compare against
Returns:

True if before is newer than time period else False

Return type:

bool

tvdbapi_client.timeutil.is_older_than(before, delta)

Checks if a datetime is older than delta

Parameters:
  • before (datetime) – a datetime to check
  • delta (timedelta) – period of time to compare against
Returns:

True if before is older than time period else False

Return type:

bool

tvdbapi_client.timeutil.utcnow()

Gets current time.

Returns:current time from utc
Return type:datetime.datetime

Module contents

Provide a simple entry point to configure an API client.

tvdbapi_client.get_client(config_file=None, apikey=None, username=None, userpass=None, service_url=None, verify_ssl_certs=None, select_first=None)

Configure the API service and creates a new instance of client.

Parameters:
  • config_file (str) – absolute path to configuration file
  • apikey (str) – apikey from thetvdb
  • username (str) – username used on thetvdb
  • userpass (str) – password used on thetvdb
  • service_url (str) – the url for thetvdb api service
  • verify_ssl_certs (str) – flag for validating ssl certs for service url (https)
  • select_first (str) – flag for selecting first series from search results
Returns:

tvdbapi client

Return type:

tvdbapi_client.api.TVDBClient