Skip to content

TV Seasons

Bases: TMDB

TV Seasons functionality.

See: https://developers.themoviedb.org/3/tv-seasons

Source code in src/tmdb_client_py/tv.py
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
class TV_Seasons(TMDB):
    """
    TV Seasons functionality.

    See: https://developers.themoviedb.org/3/tv-seasons
    """

    BASE_PATH = "tv/{tv_id}/season/{season_number}"
    URLS = {
        "info": "",
        "account_states": "/account_states",
        "credits": "/credits",
        "external_ids": "/external_ids",
        "images": "/images",
        "videos": "/videos",
    }

    def __init__(self, tv_id, season_number):
        super().__init__()
        self.tv_id = tv_id
        self.season_number = season_number

    def info(self, **kwargs):
        """
        Get the TV season details by id.

        Supports append_to_response. Read more about this at
        https://developers.themoviedb.org/3/getting-started/append-to-response.

        Args:
            language: (optional) ISO 639 code.
            append_to_response: (optional) Append requests within the same
                namespace to the response.

        Returns:
            A dict representation of the JSON returned from the API.
        """
        path = self._get_tv_id_season_number_path("info")

        response = self._GET(path, kwargs)
        self._set_attrs_to_values(response)
        return response

    def account_states(self, **kwargs):
        """
        Returns all of the user ratings for the season's episodes.

        Args:
            language: (optional) ISO 639 code.
            session_id: (required) See Authentication.
            guest_session_id: (optional) See Authentication.

        Returns:
            A dict representation of the JSON returned from the API.
        """
        path = self._get_tv_id_season_number_path("account_states")

        response = self._GET(path, kwargs)
        self._set_attrs_to_values(response)
        return response

    def credits(self, **kwargs):
        """
        Get the credits for TV season.

        Args:
            language: (optional) ISO 639 code.

        Returns:
            A dict representation of the JSON returned from the API.
        """
        path = self._get_tv_id_season_number_path("credits")

        response = self._GET(path, kwargs)
        self._set_attrs_to_values(response)
        return response

    def external_ids(self, **kwargs):
        """
        Get the external ids for a TV season. We currently support the
        following external sources.

        Media Databases: TVDB ID, Freebase MID*, Freebase ID*, TVRage ID*

        *Defunct or no longer available as a service.

        Args:
            language: (optional) ISO 639 code.

        Returns:
            A dict representation of the JSON returned from the API.
        """
        path = self._get_tv_id_season_number_path("external_ids")

        response = self._GET(path, kwargs)
        self._set_attrs_to_values(response)
        return response

    def images(self, **kwargs):
        """
        Get the images that belong to a TV season.

        Querying images with a language parameter will filter the results. If
        you want to include a fallback language (especially useful for
        backdrops) you can use the include_image_language parameter. This
        should be a comma separated value like so:
        include_image_language=en,null.

        Args:
            language: (optional) ISO 639 code.

        Returns:
            A dict representation of the JSON returned from the API.
        """
        path = self._get_tv_id_season_number_path("images")

        response = self._GET(path, kwargs)
        self._set_attrs_to_values(response)
        return response

    def videos(self, **kwargs):
        """
        Get the videos that have been added to a TV season.

        Args:
            language: (optional) ISO 639 code.

        Returns:
            A dict representation of the JSON returned from the API.
        """
        path = self._get_tv_id_season_number_path("videos")

        response = self._GET(path, kwargs)
        self._set_attrs_to_values(response)
        return response

    def _get_tv_id_season_number_path(self, key):
        return self._get_path(key).format(
            tv_id=self.tv_id, season_number=self.season_number
        )

account_states(**kwargs)

Returns all of the user ratings for the season's episodes.

Parameters:

Name Type Description Default
language

(optional) ISO 639 code.

required
session_id

(required) See Authentication.

required
guest_session_id

(optional) See Authentication.

required

Returns:

Type Description

A dict representation of the JSON returned from the API.

Source code in src/tmdb_client_py/tv.py
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
def account_states(self, **kwargs):
    """
    Returns all of the user ratings for the season's episodes.

    Args:
        language: (optional) ISO 639 code.
        session_id: (required) See Authentication.
        guest_session_id: (optional) See Authentication.

    Returns:
        A dict representation of the JSON returned from the API.
    """
    path = self._get_tv_id_season_number_path("account_states")

    response = self._GET(path, kwargs)
    self._set_attrs_to_values(response)
    return response

credits(**kwargs)

Get the credits for TV season.

Parameters:

Name Type Description Default
language

(optional) ISO 639 code.

required

Returns:

Type Description

A dict representation of the JSON returned from the API.

Source code in src/tmdb_client_py/tv.py
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
def credits(self, **kwargs):
    """
    Get the credits for TV season.

    Args:
        language: (optional) ISO 639 code.

    Returns:
        A dict representation of the JSON returned from the API.
    """
    path = self._get_tv_id_season_number_path("credits")

    response = self._GET(path, kwargs)
    self._set_attrs_to_values(response)
    return response

external_ids(**kwargs)

Get the external ids for a TV season. We currently support the following external sources.

Media Databases: TVDB ID, Freebase MID, Freebase ID, TVRage ID*

*Defunct or no longer available as a service.

Parameters:

Name Type Description Default
language

(optional) ISO 639 code.

required

Returns:

Type Description

A dict representation of the JSON returned from the API.

Source code in src/tmdb_client_py/tv.py
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
def external_ids(self, **kwargs):
    """
    Get the external ids for a TV season. We currently support the
    following external sources.

    Media Databases: TVDB ID, Freebase MID*, Freebase ID*, TVRage ID*

    *Defunct or no longer available as a service.

    Args:
        language: (optional) ISO 639 code.

    Returns:
        A dict representation of the JSON returned from the API.
    """
    path = self._get_tv_id_season_number_path("external_ids")

    response = self._GET(path, kwargs)
    self._set_attrs_to_values(response)
    return response

images(**kwargs)

Get the images that belong to a TV season.

Querying images with a language parameter will filter the results. If you want to include a fallback language (especially useful for backdrops) you can use the include_image_language parameter. This should be a comma separated value like so: include_image_language=en,null.

Parameters:

Name Type Description Default
language

(optional) ISO 639 code.

required

Returns:

Type Description

A dict representation of the JSON returned from the API.

Source code in src/tmdb_client_py/tv.py
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
def images(self, **kwargs):
    """
    Get the images that belong to a TV season.

    Querying images with a language parameter will filter the results. If
    you want to include a fallback language (especially useful for
    backdrops) you can use the include_image_language parameter. This
    should be a comma separated value like so:
    include_image_language=en,null.

    Args:
        language: (optional) ISO 639 code.

    Returns:
        A dict representation of the JSON returned from the API.
    """
    path = self._get_tv_id_season_number_path("images")

    response = self._GET(path, kwargs)
    self._set_attrs_to_values(response)
    return response

info(**kwargs)

Get the TV season details by id.

Supports append_to_response. Read more about this at https://developers.themoviedb.org/3/getting-started/append-to-response.

Parameters:

Name Type Description Default
language

(optional) ISO 639 code.

required
append_to_response

(optional) Append requests within the same namespace to the response.

required

Returns:

Type Description

A dict representation of the JSON returned from the API.

Source code in src/tmdb_client_py/tv.py
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
def info(self, **kwargs):
    """
    Get the TV season details by id.

    Supports append_to_response. Read more about this at
    https://developers.themoviedb.org/3/getting-started/append-to-response.

    Args:
        language: (optional) ISO 639 code.
        append_to_response: (optional) Append requests within the same
            namespace to the response.

    Returns:
        A dict representation of the JSON returned from the API.
    """
    path = self._get_tv_id_season_number_path("info")

    response = self._GET(path, kwargs)
    self._set_attrs_to_values(response)
    return response

videos(**kwargs)

Get the videos that have been added to a TV season.

Parameters:

Name Type Description Default
language

(optional) ISO 639 code.

required

Returns:

Type Description

A dict representation of the JSON returned from the API.

Source code in src/tmdb_client_py/tv.py
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
def videos(self, **kwargs):
    """
    Get the videos that have been added to a TV season.

    Args:
        language: (optional) ISO 639 code.

    Returns:
        A dict representation of the JSON returned from the API.
    """
    path = self._get_tv_id_season_number_path("videos")

    response = self._GET(path, kwargs)
    self._set_attrs_to_values(response)
    return response