Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing documentation for api usage #457

Open
gilzellner opened this issue Oct 27, 2019 · 2 comments
Open

missing documentation for api usage #457

gilzellner opened this issue Oct 27, 2019 · 2 comments

Comments

@gilzellner
Copy link

Hi,
I am trying to use this to manage powerdns as a python package.
Is there a doc somewhere on how to configure the endpoints for this with examples ?
Thanks

@AnalogJ
Copy link
Owner

AnalogJ commented Oct 29, 2019

Hi @gilzellner
Unfortunately there's no real documentation regarding how to use lexicon as a library, however it documented fairly well via the code.

The cli.py file documents it as follows:

config = ConfigResolver()
config.with_args(parsed_args).with_env().with_config_dir(parsed_args.config_dir)
client = Client(config)
results = client.execute()

Basically the steps are:

  1. Instantiate a ConfigResolver
  2. populate the config object. if you're going to execute lexicon programmatically, you'll probably wan to use the with_dict() method.
  3. instantiate a Client and pass the config
  4. call the execute() method on the Client to start the provider logic.

I hope that helps!

@gilzellner
Copy link
Author

Hi,

lexincon_config = {
    "provider_name" : "powerdns",
    "action": "create",
    "domain": "example.com",
    "type": "cname",
    "pdns_server": "powerdnstestgil-20001-001-test"
}

config = ConfigResolver()
config.with_dict(dict_object=lexincon_config)
client = Client(config)
results = client.execute()

and still getting this error:

/Users/gilzellner/.virtualenvs/lexicon/bin/python /Users/gilzellner/dev-private/af-python-dns-manager/main.py
Traceback (most recent call last):
File "/Users/gilzellner/dev-private/af-python-dns-manager/main.py", line 24, in <module>
client = Client(config)
File "/Users/gilzellner/.virtualenvs/lexicon/lib/python2.7/site-packages/lexicon/client.py", line 67, in __init__
self.provider = provider_class(self.config)
File "/Users/gilzellner/.virtualenvs/lexicon/lib/python2.7/site-packages/lexicon/providers/powerdns.py", line 54, in __init__
if self.api_endpoint.endswith('/'):
AttributeError: 'NoneType' object has no attribute 'endswith'

according to this line:
self.api_endpoint = self._get_provider_option('pdns_server')

the field should be populated.
what am i doing wrong ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants