Skip to content
Snippets Groups Projects
Unverified Commit f1236640 authored by Julian Coy's avatar Julian Coy Committed by GitHub
Browse files

Merge pull request #2 from bverschueren/configurable-api-base-url

add argument to Client init to use specific api base url
parents 2e771c51 eb858f5e
No related branches found
No related tags found
No related merge requests found
...@@ -3,8 +3,18 @@ import sys ...@@ -3,8 +3,18 @@ import sys
import requests import requests
try:
# python3.x
from urllib.parse import urljoin
except ImportError:
# python2.x
from urlparse import urljoin
__all__ = ['Client'] __all__ = ['Client']
GODADDY_API_BASE_URL='https://api.godaddy.com/'
GODADDY_API_VERSION='v1'
class Client(object): class Client(object):
"""The GoDaddyPy Client. """The GoDaddyPy Client.
...@@ -12,7 +22,7 @@ class Client(object): ...@@ -12,7 +22,7 @@ class Client(object):
This client is used to connect to the GoDaddy API and to perform requests with said API. This client is used to connect to the GoDaddy API and to perform requests with said API.
""" """
def __init__(self, account, log_level=None): def __init__(self, account, log_level=None, api_base_url=GODADDY_API_BASE_URL, api_version=GODADDY_API_VERSION):
"""Create a new `godaddypy.Client` object """Create a new `godaddypy.Client` object
:type account: godaddypy.Account :type account: godaddypy.Account
...@@ -26,7 +36,7 @@ class Client(object): ...@@ -26,7 +36,7 @@ class Client(object):
self.logger.setLevel(log_level) self.logger.setLevel(log_level)
# Templates # Templates
self.API_TEMPLATE = 'https://api.godaddy.com/v1' self.API_TEMPLATE = urljoin(api_base_url, api_version)
self.DOMAINS = u'/domains' self.DOMAINS = u'/domains'
self.DOMAIN_INFO = u'/domains/{domain}' self.DOMAIN_INFO = u'/domains/{domain}'
self.RECORDS = u'/domains/{domain}/records' self.RECORDS = u'/domains/{domain}/records'
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment