Skip to content

[enhancement] Accept plex servers invite #87

Open
@that-9uy

Description

@that-9uy

I would like to accept my plex servers invite on users behalf, I can currently do this with python-plexapi using acceptInvite.

And call it like this to accept users invite

def accept_plex_invitation(token: str, server_api_key: Optional[str] = None, server_url: Optional[str] = None):
    """Accept a Plex invitation

    :param token: The token of the invitation
    :type token: str

    :param server_api_key: The API key of the Plex server
    :type server_api_key: Optional[str] - If not provided, will get from database.

    :param server_url: The URL of the Plex server
    :type server_url: Optional[str] - If not provided, will get from database.

    :return: None
    """

    # Get the PlexServer object
    plex = get_plex_server(server_api_key=server_api_key, server_url=server_url)

    # Get my account from Plex and email
    my_account = plex.myPlexAccount()

    # Get plex account for the user
    plex_account = MyPlexAccount(token=token)

    # Accept the invitation and enable sync
    plex_account.acceptInvite(my_account.email)
    plex_account.enableViewStateSync()****

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Open Issues

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions