Skip to content
Discussion options

You must be logged in to vote

You're right, adding class variable __globals__ = globals() may resolve this issue:

class IPFetcher(object):
    __globals__ = globals()

    def __call__(self, request: Request) -> str:
        return request.client.host

This workaround works fine regradless of the line from __future__ import annotations.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Pandede
Comment options

Answer selected by Pandede
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question or problem
2 participants