Skip to content

Commit

Permalink
use new api for dns list
Browse files Browse the repository at this point in the history
  • Loading branch information
srgvg committed May 8, 2020
1 parent 3f0d9c1 commit 15004e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 9 additions & 2 deletions gandi/cli/core/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,17 @@ def json_call(cls, method, url, **kwargs):
"'gandi setup' command")
sys.exit(1)
if send_key:
#print(url)
if 'headers' in kwargs:
kwargs['headers'].update({'X-Api-Key': apikey})
if url.startswith('https://api.gandi.net/v5/domain'):
kwargs['headers'].update({'authorization': 'apikey ' + apikey})
else:
kwargs['headers'].update({'X-Api-Key': apikey})
else:
kwargs['headers'] = {'X-Api-Key': apikey}
if url.startswith('https://api.gandi.net/v5/domain'):
kwargs['headers'] = {'authorization': 'apikey ' + apikey}
else:
kwargs['headers'] = {'X-Api-Key': apikey}
except MissingConfiguration:
if not empty_key:
return []
Expand Down
3 changes: 2 additions & 1 deletion gandi/cli/modules/dns.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def get_sort_url(cls, url, sort_by=None):
@classmethod
def list(cls):
"""List domains."""
return cls.json_get('%s/domains' % cls.api_url)
api_url = 'https://api.gandi.net/v5/domain'
return cls.json_get('%s/domains' % api_url)

@classmethod
def type_list(cls):
Expand Down

0 comments on commit 15004e3

Please sign in to comment.