API wrapper for https://myownfreehost.net
Project description
mofh by Robert S.
An API wrapper for MyOwnFreeHost.
Installation
To install from PyPi run
pip install mofh
Documentation
Versioning
mofh uses the following versioning pattern:
major.minor.patch
- Major: Breaking changes, the bot is no longer compatible with previous versions.
- Minor: New features, no breaking changes.
- Patch: Bug fixes and small improvements.
Usage
Basic usage (creating an account)
Sync:
import mofh
# With a context manager
with mofh.Client(username="example", password="password") as client:
response = client.create(username='example', password='password', contactemail='example@example.com',
domain='subdomain.example.com', plan='MyAwesomePlan')
print(response)
# ---
# Without a context manager
client = mofh.Client(username="example", password="password")
response = client.create(username='example', password='password', contactemail='example@example.com',
domain='subdomain.example.com', plan='MyAwesomePlan')
print(response)
client.close()
Async:
import mofh
# With a context manager
async with mofh.AsyncClient(username="example", password="password") as client:
response = await client.create(username='example', password='password', contactemail='example@example.com',
domain='subdomain.example.com', plan='MyAwesomePlan')
print(response)
# ---
# Without a context manager
client = mofh.AsyncClient(username="example", password="password")
response = await client.create(username='example', password='password', contactemail='example@example.com',
domain='subdomain.example.com', plan='MyAwesomePlan')
print(response)
await client.close()
Custom session
It is possible to use custom requests or aiohttp session with configured timeouts and other settings.
Sync:
import mofh
from requests import Session
client = mofh.Client(username="example", password="password", session=Session())
Async:
import mofh
from aiohttp import ClientSession, ClientTimeout
client = mofh.AsyncClient(username="example", password="password", session=ClientSession(timeout=ClientTimeout))
Custom API URL
In case URL gets changed for some reason it is possible to overwrite the API URL:
import mofh
client = mofh.Client(username="example", password="password", api_url="https://panel.myownfreehost.net/xml-api/")
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
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 mofh-1.0.2.tar.gz.
File metadata
- Download URL: mofh-1.0.2.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a50bf4a84e6bbf0eee7b5fd56dc2921806b0da24a3d71924445a6e7b9a01267a
|
|
| MD5 |
bf4e3a52c7f756135c8ac85c6704522b
|
|
| BLAKE2b-256 |
51c042b17a2a4d1cc8faecb13c32dd22cbcd380aefe2834be0a5719bcdf5e615
|
File details
Details for the file mofh-1.0.2-py3-none-any.whl.
File metadata
- Download URL: mofh-1.0.2-py3-none-any.whl
- Upload date:
- Size: 17.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
43dcbea249cb7fd43b23d08518bf6db0eaa3c9a5780b0346a06f83f468ef27e6
|
|
| MD5 |
0e6e6bc53608c76a0fd52a26ac96056d
|
|
| BLAKE2b-256 |
52e4b54b3dfb84a11586765aeac0132f300e69627ddfdd7c0c7dbb44381fecae
|