Skip to main content

API wrapper for https://myownfreehost.net

Project description

License Compatible Python versions PyPi monthly downloads PyPi version

Tests

mofh by Robert S.

An API wrapper for MyOwnFreeHost.

Installation

To install from PyPi run

pip install mofh

Documentation

https://mofh.readthedocs.io

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

mofh-1.0.2.tar.gz (18.9 kB view hashes)

Uploaded Source

Built Distribution

mofh-1.0.2-py3-none-any.whl (17.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page