Skip to main content

Add your description here

Project description

Anzar SDK Documentation

Install The Python SDK

In a python project run the following command to install the anzar package.

uv

$ uv add anzar

pip

# in a virtual env run
$ pip install anzar

Create Anzar Auth Instance

in your main entry file (main.py for example), import anzar.yml and parse it as a YAML file

def load_config(path: str) -> AnzarConfig:
    import yaml

    try:
        with open(path, "r") as f:
            data = yaml.safe_load(f)
        return AnzarConfig(**data)
    except Exception as e:
        import sys

        sys.exit("check your configuration file: anzar.yml")

import Anzar Auth and create your auth instance

# Initialize once at application startup
# The SDK will communicate with your Anzar container at the configured api_url
from anzar import Anzar

config = load_config("anzar.yml")
anzar = Anzar(config, options=None)

Note "Configuring Token Persistence" To keep users logged in across restarts, choose a token storage adapter.

```python
from anzar.adapters import RedisStorage
from anzar.types import SdkOptions 

anzar = Anzar(config, SdkOptions(storage=RedisStorage()))
```

Basic Usage

Anzar provides authentication support for email and password.

📝 Note: Other methods of authentication will be implemented later

Sign Up

To sign up a user you need to call the method register with the user's information.

from anzar.types import ApiException, AuthResponse

try:
    data: AuthResponse = anzar.Auth.register({
      "username": "username",
      "email": "user@example.com",
      "password": "password"
    })
except ApiException as e:
    print(e.status, e.body)

📝 Note: By default, the users are automatically signed in after they successfully sign up. Disabling this behavior will be implemented later

Sign In

To sign in a user you need to call the method login.

from anzar.types import ApiException, AuthResponse

try:
    data: AuthResponse = anzar.Auth.login({
      "email": "user@example.com",
      "password": "password"
    })
except ApiException as e:
    print(e.status, e.body)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

anzar-0.3.4.tar.gz (34.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

anzar-0.3.4-py3-none-any.whl (80.1 kB view details)

Uploaded Python 3

File details

Details for the file anzar-0.3.4.tar.gz.

File metadata

  • Download URL: anzar-0.3.4.tar.gz
  • Upload date:
  • Size: 34.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for anzar-0.3.4.tar.gz
Algorithm Hash digest
SHA256 7d8cf3ed4ba84cf4ee6691f23226ef7b0e04c31119f30327f9bee0838a1594e4
MD5 a7168f0778a1d4a5b30edc5320e65ff9
BLAKE2b-256 f5cb35a236f43bc8f9c4e85a5fde54ef4ea0aa910c5e261e5052b10e2c039e02

See more details on using hashes here.

File details

Details for the file anzar-0.3.4-py3-none-any.whl.

File metadata

  • Download URL: anzar-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 80.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for anzar-0.3.4-py3-none-any.whl
Algorithm Hash digest
SHA256 3cf63b8f15465f47132a2be658f46bf80006b3685c76d42d9a0effdf9e181601
MD5 7000ee56d65b7fa2dfcdcc1547d7a590
BLAKE2b-256 a56f99e16a0f591ecea05b8061bfd8fdd5fd6a387a472c053c9251caedfb5580

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page