Newer
Older
certbot-dns-inwx / domain-check.py
#!/usr/bin/env python
# -*- encoding: UTF8 -*-

# author: InterNetworX, info →AT→ inwx.de
# author: Pascal Gollor (https://gitbucket.pgollor.de)

#############################################################################
###### This is an example of how to use the inwx class #######

from inwx.inwx import domrobot, prettyprint, getOTP
from inwx.configuration import get_account_data
import sys


def main(domain):
	api_url, username, password, shared_secret = get_account_data(True, config_file='./conf.cfg', config_section="ote")
	inwx_conn = domrobot(api_url, False)
	loginRet = inwx_conn.account.login({'lang': 'de', 'user': username, 'pass': password})
	print("login: " + str(loginRet))

	if 'resData' in loginRet:
		loginRet = loginRet['resData']
	# end if

	print("check domain: " + domain)
	checkRet = inwx_conn.domain.check({'domain': domain})
	print("check: " + str(prettyprint.domain_check(checkRet)))
# end main


if __name__ == '__main__':
	if (len(sys.argv) < 2):
		raise ValueError("Not enough arguments.")
	# end if

	domain = str(sys.argv[1])
	main(domain)
# end if