benkonrath / transip-api

Python implementation for the TransIP API
https://transip-api.readthedocs.io/en/latest/
MIT License
23 stars 23 forks source link

I can't get python module for transip to work correctly #56

Closed jeromba6 closed 4 years ago

jeromba6 commented 4 years ago

I try to get a script to work for checking / editing my dns at transip. It works partly until I realy want to do something.

Current code:


from transip.service.domain import DomainService

basedomain='gemert.net'
key='MY_KEY_IS_SECRET'

dnsservice = DomainService('MY_USERNAME', private_key=key)
print(dnsservice.get_domain_names())
print(dnsservice.check_availability(basedomain))
print(dnsservice.get_info(basedomain))

The result when running is al follows:

[mydomain1.com, mydomain2.org, mydomain3.net]
inyouraccount
Traceback (most recent call last):
  File "./setdns.py", line 49, in <module>
    print(dnsservice.get_info(basedomain))
  File "/usr/local/lib/python3.7/dist-packages/suds/__init__.py", line 166, in <lambda>
    __str__ = lambda x: x.__unicode__()
  File "/usr/local/lib/python3.7/dist-packages/suds/sudsobject.py", line 172, in __unicode__
    return self.__printer__.tostr(self)
  File "/usr/local/lib/python3.7/dist-packages/suds/sudsobject.py", line 256, in tostr
    return self.process(object, history, indent)
  File "/usr/local/lib/python3.7/dist-packages/suds/sudsobject.py", line 265, in process
    return self.print_object(object, h, n+2, nl)
  File "/usr/local/lib/python3.7/dist-packages/suds/sudsobject.py", line 312, in print_object
    s.append(self.process(item[1], h, n, True))
  File "/usr/local/lib/python3.7/dist-packages/suds/sudsobject.py", line 273, in process
    return self.print_collection(object, h, n+2)
  File "/usr/local/lib/python3.7/dist-packages/suds/sudsobject.py", line 352, in print_collection
    s.append(self.process(item, h, n-2))
  File "/usr/local/lib/python3.7/dist-packages/suds/sudsobject.py", line 265, in process
    return self.print_object(object, h, n+2, nl)
  File "/usr/local/lib/python3.7/dist-packages/suds/sudsobject.py", line 282, in print_object
    if d in h:
  File "/usr/local/lib/python3.7/dist-packages/transip/service/objects.py", line 57, in __eq__
    return self.name == other.name and self.type == other.type and self.content == other.content
AttributeError: 'list' object has no attribute 'name'
What am I doing wrong? The first 2 commands seem to work but the dnsservice.get_info(basedomain) isn't working

Version of transip module

Name: transip
Version: 2.0.0
Summary: TransIP API Connector
Home-page: https://github.com/benkonrath/transip-api
Author: Go About B.V.
Author-email: tech@goabout.com
License: MIT
Location: /usr/local/lib/python3.7/dist-packages
Requires: cryptography, suds-jurko, requests
Required-by: 

On Stackoverflow I got an anwser. Could you look on that?