Skip to content

Jonxslays/unkey.py

Repository files navigation

unkey.py

An asynchronous Python SDK for unkey.dev.

Documentation

Installation

Python version 3.8 or greater is required to use unkey.py.

Stable

pip install -U unkey.py

Development

pip install -U git+https://github.com/Jonxslays/unkey.py

For more information on using pip, check out the pip documentation.

Example

import asyncio
import os

import unkey


async def main() -> None:
    client = unkey.Client(api_key=os.environ["API_KEY"])
    await client.start()

    result = await client.keys.verify_key("prefix_123ABC", os.environ["API_ID"])

    if result.is_ok:
        data = result.unwrap()
        print(data.valid)
        print(data.owner_id)
        print(data.meta)
        print(data.error)
    else:
        print(result.unwrap_err())

    await client.close()


if __name__ == "__main__":
    asyncio.run(main())

What is unkey.dev

unkey.dev is a fully open source API key management solution. It allows you to create, manage, and validate API keys for your applications users. You can even host it yourself, that's the beauty of open source.

If you're interested in learning more about the project, consider checking out any of these links:

Contributing

unkey.py is open to contributions. Check out the contributing guide to learn how.

License

unkey.py is licensed under the GPLv3 License.

The unkey.undefined module is licensed under the MIT License.