Skip to main content

Add your description here

Project description

Anzar SDK Documentation

Installation

pip install anzar

Quick Start

from anzar import AnzarAuth

# Initialize the SDK
auth = AnzarAuth

# Use the authenticated client
# (Add specific usage examples here)

Configuration

Environment Variables

Create a .env file in your project root:

# Add your environment variables here
ANZAR_API_KEY=your_api_key
ANZAR_BASE_URL=https://api.anzar.com

API Reference

AnzarAuth

Authentication manager for user login, registration, and session management.

from anzar import AnzarAuth

Methods

login(email, password)

Authenticate a user with credentials.

Parameters:

  • email (str): User's email
  • password (str): User's password

Returns:

  • User: User object on success
  • Error: Error object on failure

Example:

result = AnzarAuth.login("user@example.com", "password123")
if isinstance(result, User):
    print(f"Logged in: {result.username}")
else:
    print(f"Login failed: {result.error}")
register(username, email, password)

Register a new user account.

Parameters:

  • username (str): Desired username
  • email (str): User's email address
  • password (str): User's password

Returns:

  • User: User object on success
  • Error: Error object on failure

Example:

result = AnzarAuth.register("newuser", "user@example.com", "password123")
logout()

Log out the current user.

Returns:

  • User: Empty user object on success
  • Error: Error object on failure

Example:

result = AnzarAuth.logout()
isLoggedIn()

Check if a user is currently logged in.

Returns:

  • User: Current user object if logged in
  • Error: Error object if not logged in

Example:

result = AnzarAuth.isLoggedIn()
if isinstance(result, User):
    print(f"Current user: {result.username}")
else:
    print("No user logged in")

Error Handling

from anzar.types import Error
try:
    result = AnzarAuth.login(email, password)
except Error as e:
    print(f"Error: {e}")

Examples

Basic Authentication Flow

from anzar import AnzarAuth

# Register new user
result = AnzarAuth.register("johndoe", "john@example.com", "securepass123")
if isinstance(result, Error):
    print(f"Registration failed: {result.message}")
    return

# Login
result = AnzarAuth.login("john@example.com", "securepass123")
if isinstance(result, Error):
    print(f"Login failed: {result.message}")
    return

print(f"Welcome {result.username}")

# Check login status
user = AnzarAuth.isLoggedIn()
if not isinstance(user, Error):
    print(f"Current user: {user.username}")

# Logout
AnzarAuth.logout()

Contributing

Instructions for contributing to the SDK.

License

License information.

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.1.10.tar.gz (6.4 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.1.10-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: anzar-0.1.10.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.17

File hashes

Hashes for anzar-0.1.10.tar.gz
Algorithm Hash digest
SHA256 ba86e99062cd3fe6a1ea9e5a4800ee75d87620c2f445c5237b3e3ef38d255c5d
MD5 b20c918b6a8631e629f3444dc9d9099b
BLAKE2b-256 e224f0271843e352a83219166bf3944f2abd14f58d088830a5c55a6d7e52c60b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: anzar-0.1.10-py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.17

File hashes

Hashes for anzar-0.1.10-py3-none-any.whl
Algorithm Hash digest
SHA256 241cd0b7f2981a6ae8f1295b6cc46aea2e56beffe45cf4a19c0dccaa8afd4ff1
MD5 1412d24fa7f5afbb8ac0871438a3d42c
BLAKE2b-256 58ff261c2d9b22ab78c2350b5c8336bff8c5618114d67db6745040cb566210f9

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