Skip to main content

Dnsmeapi Python client

simplify dnsmadeeasy api calls :- https://api-docs.dnsmadeeasy.com/?version=latest#6a7eef29-27fb-4f37-af89-e3ec4a3dcf66 Python 3.7

Tests

From the project root directory

export PYTHONPATH=$(pwd)
pytest .

Dnsmeapi Class

class Dnsmeapi:
    hmac = None
    request_date = None
    api_key = ""
    api_secret_key = ""

    def __init__(self, api_key, api_secret_key):
        self.api_key = api_key
        self.api_secret_key = api_secret_key

    def make_request(self, method_type, url, payload):
        self.request_date = formatdate(timeval=None, localtime=False, usegmt=True)
        try:
            self.hmac = hmac.new(
                bytes(self.api_secret_key, "UTF-8"),
                bytes(self.request_date, "UTF-8"),
                hashlib.sha1,
            ).hexdigest()
        except Exception as e:
            raise e

        headers = {
            "Content-Type": "application/json",
            "x-dnsme-hmac": self.hmac,
            "x-dnsme-apiKey": self.api_key,
            "x-dnsme-requestDate": self.request_date,
        }

        try:
            response = requests.request(method_type, url, headers=headers, data=payload)
            return response.text.encode('utf-8')
        except Exception as e:
            raise e

Import

from dnsmeapi import Dnsmeapi

Initalise class

dnsmeapi = Dnsmeapi( "api_key", "api_secret_key" )

Send Request

dnsmeapi.make_request( "GET", "URL", {} )

Metadata

Release files for dnsmeapi 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dnsmeapi 0.0.2
File Size Uploaded
dnsmeapi-0.0.2.tar.gz 2.2 kB Details

Release files / dnsmeapi-0.0.2.tar.gz

Download URL dnsmeapi-0.0.2.tar.gz
Size 2.2 kB
Tags Source
SHA-256 checksum
How to use checksums
907c2f7c499df943614fdb566a4c9afb8f72c85c3039c955154bfa41687da6fb
BLAKE2b-256 checksum
How to use checksums
0aac12729547754538d00a24e8af14d09a24d74f6a9c4903523aad904b2ecdd2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.2.0 requests-toolbelt/0.8.0 tqdm/4.43.0 CPython/2.7.15

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file

0.0.1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page