python - xmlrpclib error 'module not found' when trying to access gandi api -


i trying set ds record in gandi api describded in gandi api support doc

it states 'import xmlrpclib' error 'module not found' (full text reproduced below).

i found page use 'from xmlrpc import client', in context, gandi api none responsive.

python3 session:

>>> import xmlrpclib traceback (most recent call last):   file "<pyshell#69>", line 1, in <module>     import xmlrpclib importerror: no module named 'xmlrpclib' >>> xmlrpc import client >>> api = xmlrpclib.serverproxy('https://rpc.gandi.net/xmlrpc/') traceback (most recent call last):   file "<pyshell#71>", line 1, in <module>     api = xmlrpclib.serverproxy('https://rpc.gandi.net/xmlrpc/') nameerror: name 'xmlrpclib' not defined >>> api = xmlclient.serverproxy('https://rpc.gandi.net/xmlrpc/') traceback (most recent call last):   file "<pyshell#72>", line 1, in <module>     api = xmlclient.serverproxy('https://rpc.gandi.net/xmlrpc/') nameerror: name 'xmlclient' not defined >>> api = client.serverproxy('https://rpc.gandi.net/xmlrpc/') >>> apikey = '<my_api_key_here>' >>> version = api.version.info(apikey) >>> print(version) {'api_version': '3.3.29'} >>> domain.dnssec.create('key', 'domain2.com', 1, 256, 'key') traceback (most recent call last):   file "<pyshell#77>", line 1, in <module>     domain.dnssec.create('key', 'domain2.com', 1, 256, 'key') nameerror: name 'domain' not defined >>> client.dnssec.create('key', 'domain2.com', 1, 256, 'key') traceback (most recent call last):   file "<pyshell#78>", line 1, in <module>     client.dnssec.create('key', 'domain2.com', 1, 256, 'key') attributeerror: 'module' object has no attribute 'dnssec' 

how update ds record via gandi api?

update: following code provided me , errors invalid key error. key using known in php

my_in_file = open('/home/ex-mailer-domains/'+domain+'/dsset-'+domain+'.', 'rt') dstext = my_in_file.read() dslist = dstext.split()[3:7] print(dslist[3])  api = client.serverproxy('https://rpc.gandi.net/xmlrpc/') apikey = 'mykeythatworksinphpjustfineforotherscripts' api.domain.dnssec.create(apikey, 'domain2.com', {'algorithm': 8, 'flags': 256, 'public_key': dslist[3]})      xmlrpc.client.fault: <fault 510150: 'error on object : object_account (cause_noright) [invalid api key]'> 

update: key works sample code

but using other calls, still error:

>>> api = client.serverproxy('https://rpc.gandi.net/xmlrpc/') >>> apikey = 'mykeythatworksinphpjustfineforotherscripts' >>> version = api.version.info(apikey) >>> print(version) {'api_version': '3.3.29'} >>> domain.dnssec.create('xxxxx', 'domain2.com', 1, 256, '97bf8186c193ebf12a794a75fef4b331a29c1a26') 

i not sure if did give out real api key, urge change asap. in case, in python, top level variables/names not come thin air - they're introduced either import or assignment statement (x = 123), (or other statements def, class usually).

you never assigned domain variable, couldn't possibly work; same goes xmlrpclib; since import statement failed, name not defined.

thus how about:

>>> xmlrpc import client >>> api = client.serverproxy('https://rpc.gandi.net/xmlrpc/') >>> apikey = '123' >>> api.domain.dnssec.create(apikey, 'domain2.com', {'algorithm': 42,                               'flags': 123, 'public_key': 'foobarbaz'}) 

Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -