Getting started
Create an API user
Before using this library you need to create an API user in the Loopia Customer Zone under Account Settings → LoopiaAPI.
Initialize the client
from loopiase import Loopia
client = Loopia("user@loopiaapi", "my_password")
You can point to a different endpoint (useful for testing):
client = Loopia("user@loopiaapi", "my_password", url="https://api.loopia.test/RPCSERV")
Rate limits
Loopia allows up to 60 calls per minute. Of those, a maximum of 15 can be domain searches. Resellers can make a maximum of 15 domain registrations per hour by direct activation.
Error handling
Methods that modify state return "OK" on success. On failure they raise
LoopiaError with a status attribute:
from loopiase import Loopia, LoopiaError
client = Loopia("user@loopiaapi", "my_password")
try:
client.add_domain("example.com")
except LoopiaError as e:
match e.status:
case "AUTH_ERROR":
print("Invalid credentials")
case "BAD_INDATA":
print("Invalid domain name")
case "RATE_LIMITED":
print("Too many requests, slow down")
case _:
print(f"API error: {e.status}")
Possible status values:
Status |
Meaning |
|---|---|
|
Success (never raised as an error) |
|
Wrong username or password |
|
Domain is not available for registration |
|
Too many API calls |
|
A parameter has an invalid value |
|
Something went wrong |
|
Not enough credits for the operation |