Skip to content

Python SDK incorrect typing in Access Manager #198

@vatssur

Description

@vatssur

I was migrating Pubnub access manager to V3 when I referred to the official docs provided here and here.
Referring to this code:

channels = [
    Channel.id("channel-a").read(),
    Channel.pattern("channel-[A-Za-z0-9]").read(),
    Channel.id("channel-b").read().write(),
    Channel.id("channel-c").read().write(),
    Channel.id("channel-d").read().write()
]

It is very unsure about where the Channel Entity exists. It is not clarified even in the docs around Channel as an entity. After multiple cycles in the docs, I referred to the code on GitHub for clarification.
In the GrantToken file, we can see that channels is defined as Union[str, List[str]] but if we look inside the build_data function, it expects a PNResource instead of str for all of the resources that can be defined.
Final solution of how to properly define a grant_token as per access manager V3 was found in the test file here. Here we have easy to read code, replicable and complete with all the imports.
Hope this helps with any poor souls like me stuck in the migration. Will update here with more clarifications if I face further issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions