Official Python SDK for InfraForge — self-hosted project provisioning platform
Project description
InfraForge — Python SDK
Official Python client for the InfraForge platform.
Install
pip install infraforge
Quickstart
from infraforge import Client
client = Client(
url="https://infraforge.example.com",
project_slug="my-app",
api_key="if_xxxxx", # from the project settings
)
# Register a user (may return pending=True if admin approval is required)
result = client.sign_up(email="alice@example.com", password="secret123")
print(result)
# Login
session = client.sign_in(email="alice@example.com", password="secret123")
print(session.user.email, session.token)
# Run a SQL query — RLS is enforced automatically using the JWT
rows = client.query(
"SELECT id, title FROM posts WHERE author_id = current_user_id()"
)
for r in rows:
print(r["title"])
# Parameterized
rows = client.query(
"SELECT * FROM posts WHERE id = $1",
[42],
)
# Logout (clears in-memory session)
client.sign_out()
Social login (browser flow)
The InfraForge OAuth flow happens in the browser. Use social_login_url to build
the URL the user must visit; after auth, they're redirected to your app with the
JWT in the URL fragment (#token=...). Your frontend extracts it and posts it back
to your Python service, which loads it via set_token.
url = client.social_login_url(provider="google", redirect_to="https://app.example.com/callback")
# Redirect user to `url`; back in /callback, parse #token=... from JS,
# POST it to your backend, then:
client.set_token(token)
Password reset
client.request_password_reset("alice@example.com")
# Always succeeds (silent if email doesn't exist — anti-enumeration)
Error handling
All failures raise either AuthError or QueryError:
from infraforge import Client, AuthError
try:
client.sign_in("a@b.com", "wrong")
except AuthError as e:
if e.pending:
print("Account waiting admin approval")
else:
print(f"Login failed: {e}")
License
MIT
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 infraforge-0.1.0.tar.gz.
File metadata
- Download URL: infraforge-0.1.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
af0c65d163f5ea36a90600f52b91b3d01022d1c70fbe8a68ec667bf517662a25
|
|
| MD5 |
da35b541bbf792c593fc3a0b8b5861bd
|
|
| BLAKE2b-256 |
c7cb1fa9d668829cee432b4d3c91301792092fc25c34187df2906d39e0c4b6a6
|
File details
Details for the file infraforge-0.1.0-py3-none-any.whl.
File metadata
- Download URL: infraforge-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea027060834162fb8317e0a06b5340a295a031e9246dc1c6b048f2e5e044f649
|
|
| MD5 |
de93f32559940d67d6b99a5b698ee3fe
|
|
| BLAKE2b-256 |
4ae8c257a9c6d132c6f0b8e4a2e60b1db00a27c08ca033088deff99ed5f4ad99
|