Skip to content

interserver/mailbaby-client-python

Repository files navigation

openapi-client

Send emails fast and with confidence through our easy to use REST API interface.

Overview

This is the API interface to the Mail Baby Mail services provided by InterServer. To use this service you must have an account with us at my.interserver.net.

Authentication

In order to use most of the API calls you must pass credentials from the my.interserver.net site. We support several different authentication methods but the preferred method is to use the API Key which you can get from the Account Security page.

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 1.1.0
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit https://www.mail.baby/contact/

Requirements.

Python 3.7+

Installation & Usage

pip install

If the python package is hosted on a repository, you can install directly using:

pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git

(you may need to run pip with root permission: sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git)

Then import the package:

import openapi_client

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import openapi_client

Tests

Execute pytest to run the tests.

Getting Started

Please follow the installation procedure and then run the following:

import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to https://api.mailbaby.net
# See configuration.py for a list of all supported configuration parameters.
configuration = openapi_client.Configuration(
    host = "https://api.mailbaby.net"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: apiKeyAuth
configuration.api_key['apiKeyAuth'] = os.environ["API_KEY"]

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['apiKeyAuth'] = 'Bearer'


# Enter a context with an instance of the API client
with openapi_client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = openapi_client.BlockingApi(api_client)
    type = 'type_example' # str | The type of deny rule.
    data = 'data_example' # str | The content of the rule.  If a domain type rule then an example would be google.com. For a begins with type an example would be msgid-.  For the email typer an example would be [email protected].
    user = 'user_example' # str | Mail account username that will be tied to this rule.  If not specified the first active mail order will be used. (optional)

    try:
        # Creates a new email deny rule.
        api_response = api_instance.add_rule(type, data, user=user)
        print("The response of BlockingApi->add_rule:\n")
        pprint(api_response)
    except ApiException as e:
        print("Exception when calling BlockingApi->add_rule: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://api.mailbaby.net

Class Method HTTP request Description
BlockingApi add_rule POST /mail/rules Creates a new email deny rule.
BlockingApi delete_rule DELETE /mail/rules/{ruleId} Removes an deny mail rule.
BlockingApi delist_block POST /mail/blocks/delete Removes an email address from the blocked list
BlockingApi get_mail_blocks GET /mail/blocks displays a list of blocked email addresses
BlockingApi get_rules GET /mail/rules Displays a listing of deny email rules.
HistoryApi get_stats GET /mail/stats displays a list of blocked email addresses
HistoryApi view_mail_log GET /mail/log displays the mail log
SendingApi send_adv_mail POST /mail/advsend Sends an Email with Advanced Options
SendingApi send_mail POST /mail/send Sends an Email
ServicesApi get_mail_orders GET /mail displays a list of mail service orders
StatusApi ping_server GET /ping Checks if the server is running

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

apiKeyAuth

  • Type: API key
  • API key parameter name: X-API-KEY
  • Location: HTTP header

Author

[email protected]

Releases

No releases published

Packages

No packages published