Skip to content

set_context type hint incorrectly set to Any #899

@rossettistone

Description

@rossettistone

From reading the Sentry docs (https://docs.sentry.io/platforms/python/enriching-events/context/) and the source code for set_context(key: str, value: Any), we tried the following in our codebase:

with push_scope() as scope:
    scope.set_context('source_key', 'foo')  # 'source_key' is a term in our application

Unfortunately, this led to an error in the UI with the reason "expected an object".
Screen Shot 2020-10-27 at 4 43 08 PM

I may be misunderstanding something, but it seems that set_context should be annotated with value: Dict, and the docs updated accordingly. Is this correct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions