Skip to main content

Python library for CRUD operations on cdmon.com

This project will let you manage programmatically your domains in cdmon.com

How does it work?

It runs Chrome in headless mode and does what you'd do manually. There is no dark magic nor obscure hacks.

What do I need?

Any Python 3.x (+3.2 recommended) with PIP and Chrome (headless)

How can I use it?

A very basic usage example:

from cdmon import CDMON

cdmon = CDMON()
cdmon.login()

cdmon.work_on("foo.com")
cdmon.create_record("TXT", {
    "redirect_type": "custom",
    "subdomain": "bar",
    "value": "123456789"
})

cdmon.work_on("mydomain.com")
cdmon.change_record("A", "www", "127.0.0.1")
cdmon.change_record("A", "mailcow", "1.2.3.4")
cdmon.change_record("TXT", "@", "v=spf1 ...")

cdmon.work_on("xyz.com")
cdmon.delete_record("TXT", "bar")

cdmon.terminate()

Keep in mind the library uses environment variables to get the login data. You'll need to provide those, creating a .env file or by any other means.

USERNAME=
PASSWORD=
TIMEOUT=10
DEBUG=True
NETDEBUG=True
  • USERNAME - The username / email you use to login in cdmon.com
  • PASSWORD - The password
  • TIMEOUT - Make Selenium timeout after that amount of time (in seconds). Default 10.
  • DEBUG - If set to True it will show Chrome's UI. Default False.
  • NETDEBUG - If set to True it will show urllib debug to stdout. Default False.

Usage details

work_on(domain_name)

You must call this method before doing any other work, in order to let the library know on which domain you want to do the work on.

create_record(record_type, values)

record_type - The type of the record you're trying to create. It can be

  • TXT
  • SPF
  • A
  • AAAA
  • CNAME
  • MX
  • SRV
  • NS

values - A hash containing specific data for the type of record you're trying to create. Not all records need/use the same (amount of) variables. Use the following list to make sure to use the correct data.

TXT / SPF

redirect_type - The type of redirect. It can be

  • @ - The entire domain
  • * - Undefined subdomains
  • custom - A custom subdomain

subdomain - The custom subdomain. This argument makes sense only when redirect_type is set to custom.

value - The value of the record.

Examples:

  • Create a TXT record for the domain itself, with the value foo bar xyz

    cdmon.create_record("TXT", {
        "redirect_type": "@",
        "value": "foo bar xyz"
    })
    
  • Create a TXT record for test.mydomain.com, with the value hi

    cdmon.create_record("TXT", {
        "redirect_type": "custom",
        "subdomain": "test",
        "value": "hi"
    })
    

A / AAAA / CNAME / NS

redirect_type - The type of redirect. It can be

  • @ - The entire domain
  • * - Undefined subdomains
  • custom - A custom subdomain

subdomain - The custom subdomain. This argument makes sense only when redirect_type is set to custom.

destination - The IP you want to assign to the record. Note that the library won't stop you from trying to assign invalid values.

Examples:

  • Create an A record for the domain itself, pointing to 127.0.0.1

    cdmon.create_record("A", {
        "redirect_type": "@",
        "destination": "127.0.0.1"
    })
    
  • Create an AAAA record for the domain test.mydomain.com, pointing to 127.0.0.1

    cdmon.create_record("AAAA", {
        "redirect_type": "custom",
        "subdomain": "test",
        "destination": "127.0.0.1"
    })
    
  • Create a CNAME record for the domain itself, pointing to www.mydomain.com

    cdmon.create_record("CNAME", {
        "redirect_type": "@",
        "destination": "www.mydomain.com"
    })
    
  • Create an NS record for the domain test.mydomain.com, pointing to mydomain.com

    cdmon.create_record("NS", {
        "redirect_type": "custom",
        "subdomain": "test",
        "destination": "mydomain.com"
    })
    

SRV

redirect_type - The type of redirect. It can be

  • @ - The entire domain
  • * - Undefined subdomains
  • custom - A custom subdomain

subdomain - The custom subdomain. This argument makes sense only when redirect_type is set to custom.

destination - The destination you want to assign to the record. Note that the library won't stop you from trying to assign invalid values.

priority - The priority of the record.

weight - The weight of the record.

port - The port of the record.

Examples:

  • Create a SRV record for the domain itself, pointing to foobar.com 5 800 22

    cdmon.create_record("SRV", {
        "redirect_type": "@",
        "destination": "foobar.com"
        "priority": "5",
        "weight": "800",
        "port": "22"
    })
    
  • Create an SRV record for the domain mail.mydomain.com, pointing to smtp.foo.bar 10 200 465

    cdmon.create_record("SRV", {
        "redirect_type": "custom",
        "subdomain": "mail",
        "destination": "foobar.com"
        "priority": "10",
        "weight": "200",
        "port": "465"
    })
    

MX

subdomain - The subdomain.

destination - The destination you want to assign to the record. Note that the library won't stop you from trying to assign invalid values.

priority - The priority of the record.

Example:

  • Create an MX record for the domain mail.mydomain.com, pointing to foobar.com 10

    cdmon.create_record("MX", {
        "redirect_type": "custom",
        "subdomain": "mail",
        "destination": "foobar.com"
        "priority": "10"
    })
    

change_record(self, record_type, record_name, values)

This method will let you update the fields of a record. values has the same rules as the values from the create_record method.

Note that you can't update the subdomain of the record, only the rest of the fields. This is how cdmon.com works.

delete_record(record_type, record_name)

This method will let you delete a record. Note that the search is based on the type and the name (subdomain), which means that it's error prone in situation when multiple records of the same type and on the same subdomain exist, for example, multiple TXT records on the @ domain.

terminate()

Will close/quit Chrome.

Metadata

Release files for cdmon-automator 0.0.8

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

Source distribution (sdist)

Source distribution for cdmon-automator 0.0.8
File Size Uploaded Provenance
cdmon_automator-0.0.8.tar.gz 5.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for cdmon-automator 0.0.8
File Interpreter ABI Platform
cdmon_automator-0.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 12.0 kB

Release files / cdmon_automator-0.0.8.tar.gz

Download URL cdmon_automator-0.0.8.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
664dd6f4a8e72df907154469fca2da79f5444d01ac30b6ed70afb824149272b5
BLAKE2b-256 checksum
How to use checksums
440ae339225116f285081287f23652c6870c0a678f5993d22017ba7c18918c85
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

Release files / cdmon_automator-0.0.8-py3-none-any.whl

Download URL cdmon_automator-0.0.8-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d23cf710ef17c02b8c8d3d409714bfce1ed9e572a439f03924e9ecbc9bfc291d
BLAKE2b-256 checksum
How to use checksums
65a0c1a631b7cc0ec2f9eaa2e591339bf0a7dc88f64a94feb1b2382cd8dc846c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

Security for cdmon-automator 0.0.8

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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