Giter Site home page Giter Site logo

python-client's People

Contributors

ddmler avatar evilscientress avatar fsoederhuyzen avatar mundry avatar n-st avatar nickufer avatar txt-file avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

python-client's Issues

Filtering nameserver.info by type does not work

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

Impossible to install in a clean virtualenv

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

Make a new release

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?

Login with current 2FA token instead of 2FA secret

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)

Resource Warning during Unittest

/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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.