inwx / python-client Goto Github PK
View Code? Open in Web Editor NEWINWX Domrobot Python Client
Home Page: https://www.inwx.com/en/
License: MIT License
INWX Domrobot Python Client
Home Page: https://www.inwx.com/en/
License: MIT License
Hi,
when doing a
api_client.call_api(api_method="nameserver.info", method_params={'domain': 'mydomain.com', 'name': 'somename', 'type': 'AAAA'} )
it does also contain the MASTER type but it should only return the type AAAA since it was requested in the API call.
BR
Patrick
Hi,
it would be nice if we would have examples for updating AAAA/A and CNAME entries for a given domain.
MTIA and BR
Patrick
The folling error occurs if you want to install this package in a clean virtualenv:
ERROR: Command errored out with exit status 1:
command: /home/bh/projects/dns_update/.venv/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-muptp7nc/inwx-domrobot/setup.py'"'"'; __file__='"'"'/tmp/pip-install-muptp7nc/inwx-domrobot/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
cwd: /tmp/pip-install-muptp7nc/inwx-domrobot/
Complete output (9 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-muptp7nc/inwx-domrobot/setup.py", line 2, in <module>
from INWX.Domrobot import ApiClient
File "/tmp/pip-install-muptp7nc/inwx-domrobot/INWX/__init__.py", line 1, in <module>
from INWX.Domrobot import ApiClient, ApiType
File "/tmp/pip-install-muptp7nc/inwx-domrobot/INWX/Domrobot.py", line 10, in <module>
import requests
ModuleNotFoundError: No module named 'requests'
----------------------------------------
How to reproduce:
$ python -m venv .venv
$ source .venv/bin/activate
$ pip install inwx-domrobot==3.0.3
requests
is a dependency which ins not avaibale at install time.
The bad workaround would be:
$ python -m venv .venv
$ source .venv/bin/activate
$ pip install requests
$ pip install inwx-domrobot==3.0.3
After the current release on PyPI (and GitHub), there have been a few interesting commits in this repo. Would it be possible to create a new one to avoid manual steps for users?
Currently, the login
function provided by this Python client requires the user to provide the shared_secret
that the current 2FA setup is based on.
This is convenient for non-interactive scripts, but can be considered a security risk, since storing the shared_secret
in a retrievable form reduces the second factor to "just another static password".
It would be nice to have an alternative option to log in with the current time-based 2FA token instead.
Until then, users can work around this limitation by using the call_api
function directly (which is essentially duplicating the login
logic, though):
def login_totp(self, username: str, password: str, totp_token: int = None) -> dict:
"""Performs a login at the api and saves the session cookie for following api calls.
"""
if username is None or password is None:
raise Exception('Username and password must not be None.')
params = {
'lang': self.language,
'user': username,
'pass': password
}
login_result = self.call_api('account.login', params)
if login_result['code'] == 1000 and 'tfa' in login_result['resData'] and login_result['resData']['tfa'] != '0':
if totp_token is None:
raise Exception('Api requests two factor challenge but no TOTP token is given. Aborting.')
unlock_result = self.call_api('account.unlock', {'tan': totp_token})
if unlock_result['code'] != 1000:
return unlock_result
return login_result
from INWX.Domrobot import ApiClient
api_client = ApiClient(api_url=ApiClient.API_LIVE_URL, debug_mode=True)
login_result = login_totp(api_client, 'janedoe', 'verysecret', 456890)
/usr/lib/python3.8/socket.py:740: ResourceWarning: unclosed <socket.socket fd=3, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.1.103', 60754), raddr=('185.181.104.71', 443)>
self._sock = None
ResourceWarning: Enable tracemalloc to get the object allocation traceback
This happens during nameserver.createRecord, nameserver.deleteRecord, nameserver.updateRecord and nameserver.info if called by python3 unittest.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.