Skip to content

Environment variable API key only works if set before import #31

Description

@jonathan-kosgei

api_key=os.environ.get("IPDATA_API_KEY") is a default parameter, evaluated once at import time. If a user sets IPDATA_API_KEY after importing ipdata and then calls IPData(), it raises IPDataException. The fix is to use api_key=None as the default and check os.environ.get() inside the method body.

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