Python SDK
Installation
pip install moontrazeQuick Start
from moontraze import MoonSDK, MoonConfig
moon = MoonSDK(MoonConfig(
project_id='YOUR_PROJECT_ID',
api_key='YOUR_API_KEY',
))
# Auth
result = moon.auth.register('user@example.com', 'secret123', 'John')
moon.set_token(result['token'])
moon.auth.login('user@example.com', 'secret123')
moon.auth.logout()
moon.auth.change_password('oldSecret', 'newSecret')
# Database
moon.db.set('users/user_123', {'name': 'John'})
user = moon.db.get('users/user_123')
moon.db.update_field('users/user_123', 'status', 'verified')
moon.db.delete_field('users/user_123', 'phone')
moon.db.delete('users/user_123')
# Storage
with open('photo.jpg', 'rb') as f:
upload = moon.storage.upload(f, 'photo.jpg')
files = moon.storage.list()
moon.storage.create_folder('My Folder')
moon.storage.delete(file_id)
moon.storage.delete_folder(folder_id)
quota = moon.storage.get_quota()
# Notifications
moon.notifications.register_token(fcm_token, {'platform': 'android'})
moon.notifications.send_to_project('project_id', title='Hello', body='World')
moon.notifications.send_to_user('user_id', title='Hi', body='There')
moon.notifications.send_to_topic(topic='premium', title='Hi', body='There')
history = moon.notifications.get_history(50)Registry
- PyPI: moontraze (opens in a new tab)
- Source: GitHub (opens in a new tab)