Skip to content

Guest Sessions

Bases: TMDB

Guest Sessions functionality.

See: https://developers.themoviedb.org/3/guest-sessions

Source code in src/tmdb_client_py/account.py
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
class GuestSessions(TMDB):
    """
    Guest Sessions functionality.

    See: https://developers.themoviedb.org/3/guest-sessions
    """

    BASE_PATH = "guest_session"
    URLS = {
        "rated_movies": "/{guest_session_id}/rated/movies",
        "rated_tv": "/{guest_session_id}/rated/tv",
        "rated_tv_episodes": "/{guest_session_id}/rated/tv/episodes",
    }

    def __init__(self, guest_session_id=0):
        super().__init__()
        self.guest_session_id = guest_session_id

    def _get_guest_session_id_path(self, key):
        return self._get_path(key).format(guest_session_id=self.guest_session_id)

    def rated_movies(self, **kwargs):
        """
        Get the rated movies for a guest session.

        Args:
            language: (optional) ISO 639-1 code.
            sort_by: (optional) Allowed Values: created_at.asc, created_at.desc

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

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

    def rated_tv(self, **kwargs):
        """
        Get the rated TV shows for a guest session.

        Args:
            language: (optional) ISO 639-1 code.
            sort_by: (optional) Allowed Values: created_at.asc, created_at.desc

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

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

    def rated_tv_episodes(self, **kwargs):
        """
        Get the rated TV episodes for a guest session.

        Args:
            language: (optional) ISO 639-1 code.
            sort_by: (optional) Allowed Values: created_at.asc, created_at.desc

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

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

rated_movies(**kwargs)

Get the rated movies for a guest session.

Parameters:

Name Type Description Default
language

(optional) ISO 639-1 code.

required
sort_by

(optional) Allowed Values: created_at.asc, created_at.desc

required

Returns:

Type Description

A dict representation of the JSON returned from the API.

Source code in src/tmdb_client_py/account.py
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
def rated_movies(self, **kwargs):
    """
    Get the rated movies for a guest session.

    Args:
        language: (optional) ISO 639-1 code.
        sort_by: (optional) Allowed Values: created_at.asc, created_at.desc

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

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

rated_tv(**kwargs)

Get the rated TV shows for a guest session.

Parameters:

Name Type Description Default
language

(optional) ISO 639-1 code.

required
sort_by

(optional) Allowed Values: created_at.asc, created_at.desc

required

Returns:

Type Description

A dict representation of the JSON returned from the API.

Source code in src/tmdb_client_py/account.py
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
def rated_tv(self, **kwargs):
    """
    Get the rated TV shows for a guest session.

    Args:
        language: (optional) ISO 639-1 code.
        sort_by: (optional) Allowed Values: created_at.asc, created_at.desc

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

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

rated_tv_episodes(**kwargs)

Get the rated TV episodes for a guest session.

Parameters:

Name Type Description Default
language

(optional) ISO 639-1 code.

required
sort_by

(optional) Allowed Values: created_at.asc, created_at.desc

required

Returns:

Type Description

A dict representation of the JSON returned from the API.

Source code in src/tmdb_client_py/account.py
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
def rated_tv_episodes(self, **kwargs):
    """
    Get the rated TV episodes for a guest session.

    Args:
        language: (optional) ISO 639-1 code.
        sort_by: (optional) Allowed Values: created_at.asc, created_at.desc

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

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