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 emailpassword(str): User's password
Returns:
User: User object on successError: 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 usernameemail(str): User's email addresspassword(str): User's password
Returns:
User: User object on successError: 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 successError: Error object on failure
Example:
result = AnzarAuth.logout()
isLoggedIn()
Check if a user is currently logged in.
Returns:
User: Current user object if logged inError: 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file anzar-0.2.2.tar.gz.
File metadata
- Download URL: anzar-0.2.2.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dfb7f69b81c017e2ba4c8ec55b563fe63c102ee883e8892e3981a790ed6b9ed2
|
|
| MD5 |
3bab40d860c36d5f364bccc450e2880f
|
|
| BLAKE2b-256 |
54471723447a70491e4ab014eb7d2396d64c4445f0e0f5eda5697c580e034e2c
|
File details
Details for the file anzar-0.2.2-py3-none-any.whl.
File metadata
- Download URL: anzar-0.2.2-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c456e366a016762bb79917b3a5e106d3e5682e81ecf2a297a74733f1dbf21eb9
|
|
| MD5 |
472392309533fd9c2fc00a2833a7fe5a
|
|
| BLAKE2b-256 |
73bd84488ccc00ae277ca7f7d359fae74f454f6dda3ddd2f82e5948154d0d017
|